3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jsonData = '[{"id":"1","component":"crank","brand":"part1","date_":"13\/11\/2019"},{"id":"2","component":"rim","date_":"13\/11\/2019","location":"Front","servicetype":"part 2"},{"id":"3","component":"bar","brand":"part 3","date_":"13\/11\/2019"}]'; $id = 2; $dataToSort = json_decode($jsonData); foreach($dataToSort as $Key => $element) { if ($element->id == $id) { unset($dataToSort[$Key]); echo $id . " Deleted\n"; } } $newJsonData = json_encode(array_values($dataToSort), JSON_PRETTY_PRINT); echo $newJsonData;
Output for git.master, git.master_jit, rfc.property-hooks
2 Deleted [ { "id": "1", "component": "crank", "brand": "part1", "date_": "13\/11\/2019" }, { "id": "3", "component": "bar", "brand": "part 3", "date_": "13\/11\/2019" } ]

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:
176.51 ms | 406 KiB | 5 Q