3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$contents = file_get_contents($path); $contents = "sku-vendeur quantit prix id-produit 10000 3 51,95 B00E3LV204 10002 3 85,96 B00PE9ZC1E 100024 3 345,73 B01LWMZ33O 100031 3 88,22 B018NOSAZ6"; preg_match_all("/^(.*?)\s+(.*?)\s+(.*?)\s+(.*?)$/m", $contents, $arr); unset($arr[0]); // remove 0 since we don't need it. $keys = array_column($arr, 0); foreach($arr[1] as $key2 => $val){ if($key2 != 0){ $new[] = array_combine($keys,array_column($arr, $key2)); } } var_dump($new);
Output for git.master_jit, git.master, rfc.property-hooks
array(4) { [0]=> array(4) { ["sku-vendeur"]=> string(0) "" ["quantit"]=> string(5) "10000" ["prix"]=> string(1) "3" ["id-produit"]=> string(18) "51,95 B00E3LV204" } [1]=> array(4) { ["sku-vendeur"]=> string(0) "" ["quantit"]=> string(5) "10002" ["prix"]=> string(1) "3" ["id-produit"]=> string(18) "85,96 B00PE9ZC1E" } [2]=> array(4) { ["sku-vendeur"]=> string(0) "" ["quantit"]=> string(6) "100024" ["prix"]=> string(1) "3" ["id-produit"]=> string(18) "345,73 B01LWMZ33O" } [3]=> array(4) { ["sku-vendeur"]=> string(0) "" ["quantit"]=> string(6) "100031" ["prix"]=> string(1) "3" ["id-produit"]=> string(18) "88,22 B018NOSAZ6" } }

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.98 ms | 407 KiB | 5 Q