3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dbjunk = "Itemid:Quantity:Price:name, itemid2:quantity2:price2:name2"; $parsed = parseItems($dbjunk); foreach($parsed as $p){ list($itemID, $Quantity, $Price, $name) = array_values($p); var_dump($itemID, $Quantity, $Price, $name); } 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, rfc.property-hooks
string(6) "Itemid" string(8) "Quantity" string(5) "Price" string(4) "name" string(8) " itemid2" string(9) "quantity2" string(6) "price2" string(5) "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:
61.38 ms | 401 KiB | 8 Q