using expressions in echo?
Posted: Tue Apr 01, 2008 12:24 pm
is it possible?
for example:
i want to increase $i by 1 after array element was displayed.
stuff like
or
isn't working. Is it possible to achieve this without creating another var? 
for example:
Code: Select all
function find_value($array, $value) {
for($i = 0; $i < sizeof($array); $i++) {
if($array[$i] == $value) {
return "{$array[$i]} is $i";
}
}
}
$fruits = array("orange", "apple", "banana");
echo find_value($fruits, "apple");
stuff like
Code: Select all
return "{$array[$i]} is $i++";Code: Select all
return "{$array[$i]} is {$i++}";