3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testString = <<<EOF id1 name1 lastname1 age1 birthdate1 id2 name2 lastname2 age2 birthdate2 id3 name3 lastname3 age3 birthdate3 id4 name4 lastname4 age4 birthdate4 EOF; $stringArray = explode("\n", $testString); $finalArray = array(); foreach ($stringArray as $lineNo => $line) { $strArray = str_getcsv($line, ' ', ''); $firstVal = array_shift($strArray); $finalArray[$firstVal] = array_combine(array( 'name', 'lastname', 'age', 'birthdate' ),$strArray ); } print_r($finalArray);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [id1] => Array ( [name] => name1 [lastname] => lastname1 [age] => age1 [birthdate] => birthdate1 ) [id2] => Array ( [name] => name2 [lastname] => lastname2 [age] => age2 [birthdate] => birthdate2 ) [id3] => Array ( [name] => name3 [lastname] => lastname3 [age] => age3 [birthdate] => birthdate3 ) [id4] => Array ( [name] => name4 [lastname] => lastname4 [age] => age4 [birthdate] => birthdate4 ) )

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:
27.32 ms | 407 KiB | 5 Q