LIMIT Data Stored in Array PHP

Discussion in 'PHP' started by you-cubez, Jun 2, 2007.

  1. #1
    Hi - SELECTing information in PHP allows you to add the following:

    SELECT ........ LIMIT 5 - Only allowing 5 pieces of information to be shown!

    How do you code this for an array of information??

    Many Thanks
     
    you-cubez, Jun 2, 2007 IP
  2. brealmz

    brealmz Well-Known Member

    Messages:
    335
    Likes Received:
    24
    Best Answers:
    3
    Trophy Points:
    138
  3. duilen

    duilen Active Member

    Messages:
    354
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Nice function! I will have to commit that to memory.
     
    duilen, Jun 2, 2007 IP
  4. you-cubez

    you-cubez Active Member

    Messages:
    842
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I have:

    $data = array();

    So do I just replace the line with:

    $data = array_slice($array, int offset [, int 5])
     
    you-cubez, Jun 3, 2007 IP