3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = '{ "46ffacdf-8009-4e7f-9076-1f7f59b152ee": { "variations": { "0": { "_value": { "value": "24,73" }, "_sku": { "value": "79" } } }, "selected": { }, "values": { "0": { } }, "default_variant": "0" }, "48a14646-9b57-44eb-98bc-9c34139bfcd6": { "0": { "file": "images\/237.jpg", "title": "", "link": "", "target": "0", "rel": "" } }, "fff28767-8e69-4c58-ac8b-9ce290c38548": { "0": { "value": "" } }, "8056b532-4837-4514-9d20-6399215a93d9": { "value": "1" } }'; $string = json_decode($string, true, 512, JSON_THROW_ON_ERROR); foreach ($string as $item){ if (isset($item['variations'][0]['_value']['value'])) $value = $item['variations'][0]['_value']['value']; if (isset($item[0]['file'])) $file = $item[0]['file']; } echo $value; echo "\n"; echo $file;
Output for 7.4.16, 8.1.23 - 8.1.34, 8.2.10 - 8.2.32, 8.3.0 - 8.3.4, 8.3.6 - 8.3.33, 8.4.1 - 8.4.24, 8.5.0 - 8.5.9
24,73 images/237.jpg
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 24,73 images/237.jpg

preferences:
104.35 ms | 889 KiB | 4 Q