3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dbjunk = "Itemid:Quantity:Price:name, itemid2:quantity2:price2:name2"; $parsed = parseItems($dbjunk); print_r($parsed); function parseItems($dbjunk){ $cart = array(); $items = explode(",",$dbjunk); foreach($items as $i){ $chunks = explode(":", $i); $cart[] = array( "ItemID" => $chunks[0] , "Quantity" => $chunks[1] , "Price" => $chunks[2] , "name" => $chunks[3] ); } return $cart; }
Output for git.master, git.master_jit
Array ( [0] => Array ( [ItemID] => Itemid [Quantity] => Quantity [Price] => Price [name] => name ) [1] => Array ( [ItemID] => itemid2 [Quantity] => quantity2 [Price] => price2 [name] => name2 ) )

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:
12.86 ms | 459 KiB | 5 Q