[ create a new paste ] login | about

Link: http://codepad.org/zTRRjLdl    [ raw code | output | fork ]

PHP, pasted on Aug 4:
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 :)";
}

?>


Output:
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 :)


Create a new paste based on this one


Comments: