1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?php $myArr = $array = array('a', 'b', 0, 'c', null, 'd'); $count = count($myArr); $index = 0; foreach($myArr as $value) { var_dump($value); $index++; if($index == $count) echo "Its the last one here :)"; } ?>
1 2 3 4 5 6 7
string(1) "a" string(1) "b" int(0) string(1) "c" NULL string(1) "d" Its the last one here :)