3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array(); $a[]=15; $a[] = '16'; $i= 0; foreach($a as $key=>$value){ $i++; $b['app']='apple'; $b['ora']='orange'; $c = array('iphone','nexus','iphone','micromax'); foreach($c as $ckey=>$cvalue){ if($cvalue=='iphone'){ $b['phone']=$cvalue; } var_dump($b)."<br>"; echo "calling a function<br>"; unset($b['phone']); } } var_dump($a);
based on ebgXp
Output for 4.3.0 - 7.2.0
array(3) { ["app"]=> string(5) "apple" ["ora"]=> string(6) "orange" ["phone"]=> string(6) "iphone" } calling a function<br>array(2) { ["app"]=> string(5) "apple" ["ora"]=> string(6) "orange" } calling a function<br>array(3) { ["app"]=> string(5) "apple" ["ora"]=> string(6) "orange" ["phone"]=> string(6) "iphone" } calling a function<br>array(2) { ["app"]=> string(5) "apple" ["ora"]=> string(6) "orange" } calling a function<br>array(3) { ["app"]=> string(5) "apple" ["ora"]=> string(6) "orange" ["phone"]=> string(6) "iphone" } calling a function<br>array(2) { ["app"]=> string(5) "apple" ["ora"]=> string(6) "orange" } calling a function<br>array(3) { ["app"]=> string(5) "apple" ["ora"]=> string(6) "orange" ["phone"]=> string(6) "iphone" } calling a function<br>array(2) { ["app"]=> string(5) "apple" ["ora"]=> string(6) "orange" } calling a function<br>array(2) { [0]=> int(15) [1]=> string(2) "16" }