3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrays = array("foo-1" => array(array("A", 3), array("B", 3)), "foo-2" => array(array("A", 1), array("B", 7)), "foo-3" => array(array("A", 1), array("B", 6))); $names = "("; $letters = "("; $numbers = ""; $coordinate = ""; foreach($arrays as $arrayName => $array) { if(array_search($arrayName, array_keys($arrays)) == 0) { $names .= $arrayName; }else{ $names .= ",".$arrayName; } foreach($array as $key => $nestedArray) { foreach($nestedArray as $letterOrNum => $value) { if($letterOrNum == 0) { // it's a letter if($key + 1 == 1) { $nextLetter = $array[$key + 1][0]; if (!strpos($letters, $value.','.$nextLetter) !== false) { if($key == 0 && array_search($arrayName, array_keys($arrays)) == 0) { $letters .= $value; }else{ $letters .= ",".$value; } } }else{ $previousLetter = $array[$key - 1][0]; if (!strpos($letters, $previousLetter.','.$value) !== false) { if($key == 0 && array_search($arrayName, array_keys($arrays)) == 0) { $letters .= $value; }else{ $letters .= ",".$value; } } } }else{ // its a number if($key == 0) { $coordinate .= "(".$value.","; }else{ $coordinate .= $value.")"; } $numbers .= $coordinate; $coordinate = ""; } } } } $names .= ")"; $letters .= ")"; echo $names; echo $letters; echo $numbers;
Output for git.master, git.master_jit, rfc.property-hooks
(foo-1,foo-2,foo-3)(A,B)(3,3)(1,7)(1,6)

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:
30.28 ms | 405 KiB | 5 Q