3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "id": "220", "pin_list": [ { "id": "1", "name": "1. La Sagrada Familia" }, { "id": "2", "name": "2. Park Guell" }, { "id": "3", "name": "10. Casa Batllo" }, { "id": "4", "name": "11. Cathedral of Barcelona" }, { "id": "5", "name": "3. Picasso Museum" }, { "id": "6", "name": "Zebra" }, { "id": "7", "name": "Apple" }, { "id": "8", "name": "Monkey" } ] }'; $array = json_decode($json, true); usort($array['pin_list'], function ($a, $b) { return strnatcmp($a['name'], $b['name']); }); echo json_encode($array, JSON_PRETTY_PRINT);
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
{ "id": "220", "pin_list": [ { "id": "1", "name": "1. La Sagrada Familia" }, { "id": "2", "name": "2. Park Guell" }, { "id": "5", "name": "3. Picasso Museum" }, { "id": "3", "name": "10. Casa Batllo" }, { "id": "4", "name": "11. Cathedral of Barcelona" }, { "id": "7", "name": "Apple" }, { "id": "8", "name": "Monkey" }, { "id": "6", "name": "Zebra" } ] }
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
2075.35 ms | 408 KiB | 5 Q