how to limit the values in array variable?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sidhx
    New Member
    • Dec 2009
    • 50

    how to limit the values in array variable?

    hi
    In my code i have sorted the high_score
    through this
    arsort($highsco re_user);
    // $highscore_user is associated array(i.e. id=>score)
    Now i want limit it ,say 10 sorted array value of it.
    How to do it


    Regards
    Sid
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    try this

    Comment

    • sidhx
      New Member
      • Dec 2009
      • 50

      #3
      hey johny i just want to remove excess value from this $highscore_user .

      Comment

      • johny10151981
        Top Contributor
        • Jan 2010
        • 1059

        #4
        copy to another array

        Comment

        • sidhx
          New Member
          • Dec 2009
          • 50

          #5
          hi johny i got sorted out.
          Can help me in this,Can i send array value like
          $lang=array('Pr ogrammer', 'Senior Programmer', and so on...)
          to this



          SELECT f_name, l_name, title from
          employee_data where title IN
          (___________Som e what here $lang__________ ___);

          instead of this way

          SELECT f_name, l_name, title from
          employee_data where title IN
          ('Programmer', 'Senior Programmer',
          'Multimedia Programmer');

          bz $lang varies constantly

          Comment

          • johny10151981
            Top Contributor
            • Jan 2010
            • 1059

            #6
            certainly you can just check foreach iterator. you will get the idea properly.

            its simple

            Comment

            • sidhx
              New Member
              • Dec 2009
              • 50

              #7
              i know to use foreach loop but its not the efficient(mean its takes more time) way to do query so i ask other way round

              Comment

              Working...