3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( "action: Added; amount: 1; code: RNA1; name: Mens Organic T-shirt; colour: White; size: XL", "action: Subtracted; amount: 7; code: RNC1; name: Kids Basic T-shirt; colour: Denim Blue; size: 3-4y", "action: Added; amount: 20; code: RNV1; name: Gift Voucher; style: Mens; value: £20", ); $data = []; foreach ($arr as $line) { $newItem = []; foreach (explode(';', $line) as $item) { $parts = explode(':', $item); $newItem[trim($parts[0])] = trim($parts[1]); } $data[] = $newItem; } print_r($data);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [action] => Added [amount] => 1 [code] => RNA1 [name] => Mens Organic T-shirt [colour] => White [size] => XL ) [1] => Array ( [action] => Subtracted [amount] => 7 [code] => RNC1 [name] => Kids Basic T-shirt [colour] => Denim Blue [size] => 3-4y ) [2] => Array ( [action] => Added [amount] => 20 [code] => RNV1 [name] => Gift Voucher [style] => Mens [value] => £20 ) )

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