3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getMeat($foods) { if (!isset($foods['meats'])) { throw new Exception('There is no meat in this pie'); } $meatCount = count($foods['meats']); if($meatCount < 1) { throw new Exception('Where did all the meat go!?'); } var_dump($foods); $i = 0; $j = 1; while($i < $meatCount) { if ($foods['meats'][$i] < $foods['meats'][$j]) { $tempMeat = $foods['meats'][$i]; $foods['meats'][$i] = $foods['meats'][$j]; $foods['meats'][$j] = $tempMeat; } $i++; $j++; } var_dump($foods); } $foods = array( 'meats' => array('zucci', 'burgers', 'steak', 'sausages', 'kebabs'), 'cake' => array('victorian', 'chocolate', 'fruit', 'fudge'), ); getMeat($foods);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["meats"]=> array(5) { [0]=> string(5) "zucci" [1]=> string(7) "burgers" [2]=> string(5) "steak" [3]=> string(8) "sausages" [4]=> string(6) "kebabs" } ["cake"]=> array(4) { [0]=> string(9) "victorian" [1]=> string(9) "chocolate" [2]=> string(5) "fruit" [3]=> string(5) "fudge" } } Warning: Undefined array key 5 in /in/s9kNh on line 23 array(2) { ["meats"]=> array(5) { [0]=> string(5) "zucci" [1]=> string(5) "steak" [2]=> string(8) "sausages" [3]=> string(6) "kebabs" [4]=> string(7) "burgers" } ["cake"]=> array(4) { [0]=> string(9) "victorian" [1]=> string(9) "chocolate" [2]=> string(5) "fruit" [3]=> string(5) "fudge" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
37.23 ms | 403 KiB | 8 Q