3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "11111*1; 22222*1; 33333*1; 44444*1"; $array = explode('; ', $string); $new = []; foreach($array as $k => $v){ $parts = explode('*', $v); $new[] = [ 'sku' => $parts[0], 'qty' => $parts[1], ]; } echo json_encode($new, JSON_PRETTY_PRINT); // JSON_PRETTY_PRINT is just for displaying it nicely here
Output for git.master, git.master_jit, rfc.property-hooks
[ { "sku": "11111", "qty": "1" }, { "sku": "22222", "qty": "1" }, { "sku": "33333", "qty": "1" }, { "sku": "44444", "qty": "1" } ]

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:
66.16 ms | 401 KiB | 8 Q