[ create a new paste ] login | about

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

PHP, pasted on Jul 8:
1
2
3
4
5
6
7
8
9
<?php
$arr = array(0,1,'test',2,3);

foreach($arr as $i=>$el){
  if($el == 'test')
     echo 'test, ';
  else
     echo $i.', ';
}


Output:
1
test, 1, test, 3, 4, 


Create a new paste based on this one


Comments: