3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $final[0] = "San"; $final[1] = "Antonio"; $final[2] = "de"; $final[3] = "Areco"; $final[4] = 1200; foreach ($final as $c => $v) { if (ctype_alpha($v)) { $vuelta1 = ($c+1); var_dump($v); if (ctype_alpha($final[$vuelta1])) { $final[$vuelta1] = $v." ".$final[$vuelta1]; unset($final[$c]); var_export($final); } } } var_dump($final);
Output for 4.3.0 - 7.1.0
string(3) "San" array ( 1 => 'San Antonio', 2 => 'de', 3 => 'Areco', 4 => 1200, )string(7) "Antonio" array ( 2 => 'Antonio de', 3 => 'Areco', 4 => 1200, )string(2) "de" array ( 3 => 'de Areco', 4 => 1200, )string(5) "Areco" array(2) { [3]=> string(8) "de Areco" [4]=> int(1200) }