3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jsonProducts = '[ { "name": "Fluted Guard of the Moon Rider", "icon": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxMfcRlFwIBYYpbaaOA9vxv_MdC8M7tq0xoaOzvb2Z7iJxD8GsJIi0--Up9Sh0A2yr0pvZ22iJdXGdVQ5NUaQpAZGHIGG2g" }, { "name": "Lion Quiver of the Moon Rider", "icon": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxtraRVhmahdbiauwIhFlwb2aImoS7oWwzIPYwqetYeKExm9SsMAg3b7AoNz32QDkqUNtMD2lJdPGbEZgNjYx8IO6" }, { "name": "Lion Quiver of the Moon Rider", "icon": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxtraRVhmahdbiauwIhFlwb2aImoS7oWwzIPYwqetYeKExm9SsMAg3b7AoNz32QDkqUNtMD2lJdPGbEZgNjYx8IO6" } ]'; $jsonData = '{ "data": [ { "updated_at": 1576048969000, "prices": { "last": 5300 }, "name": "Lion Quiver of the Moon Rider" }, { "updated_at": 1576048969000, "prices": { "last": 2000.12 }, "name": "T-shirts" } ] }'; echo "<pre>"; $price = json_decode($jsonData, 1)['data']; $json = json_decode($jsonProducts, 1); foreach($price as $key => $value) { foreach($json as $k => $value2) { if ($value['name'] === $value2['name']){ $json[$k]['price'] = $value['prices']['last']; } } } print_r($json);
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => Array ( [name] => Fluted Guard of the Moon Rider [icon] => -9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxMfcRlFwIBYYpbaaOA9vxv_MdC8M7tq0xoaOzvb2Z7iJxD8GsJIi0--Up9Sh0A2yr0pvZ22iJdXGdVQ5NUaQpAZGHIGG2g ) [1] => Array ( [name] => Lion Quiver of the Moon Rider [icon] => -9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxtraRVhmahdbiauwIhFlwb2aImoS7oWwzIPYwqetYeKExm9SsMAg3b7AoNz32QDkqUNtMD2lJdPGbEZgNjYx8IO6 [price] => 5300 ) [2] => Array ( [name] => Lion Quiver of the Moon Rider [icon] => -9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxtraRVhmahdbiauwIhFlwb2aImoS7oWwzIPYwqetYeKExm9SsMAg3b7AoNz32QDkqUNtMD2lJdPGbEZgNjYx8IO6 [price] => 5300 ) )

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:
59.95 ms | 403 KiB | 8 Q