Please help me to translate this pseudo-code to real php code:
foreach ($arr as $k => $v) if ( THIS IS NOT THE LAST ELEMENT IN THE ARRAY) doS
My solution, also quite simple..
$array = [...]; $last = count($array) - 1; foreach($array as $index => $value) { if($index == $last) // this is last array else // this is not last array }