Jump to content

if end of array in loop help


MDanz

Recommended Posts

How do i do if i've reached of array?  i know i could do end of loop.  but the array is present many times in my code.

 

while($row = mysql_fetch_assoc($getdetails)) {
$people = $row['people'];
$_SESSION['people'][] = $people;

    if(end($_SESSION['people'])) {
    //code

    }
}

Link to comment
Share on other sites

$_SESSION['people'] is an array.  I add to $_SESSION['people'] by doing this...

$_SESSION['people'][] = $people;

 

basically how do i code "if last key in array?"..

 

i tried this but it's not correct

 if(end($_SESSION['people'])) {
    //code

    }

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.