3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getParts() { return json_decode(<<<EOF [ { "name": "lorem ipsum", "category": "hi", "quantity": "2", "price": "55", "id": 1756378, "shelf": "30", "slot": "173" }, { "name": "foo bar", "category": "there", "quantity": "2", "price": "90", "id": 1181335, "shelf": "", "slot": "" } ] EOF , true); } function getPartByName($name) { $matches = []; $parts = getParts(); foreach ($parts as $part) { if (str_starts_with($part['name'], $name)) { $matches[] = $part; } } return $matches; } print_r(getPartByName('lorem'));
Output for git.master_jit, git.master, rfc.property-hooks
Array ( [0] => Array ( [name] => lorem ipsum [category] => hi [quantity] => 2 [price] => 55 [id] => 1756378 [shelf] => 30 [slot] => 173 ) )

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