3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "channel": { "id": "xxxxxxx", "field1": "A", "created_at": "2021-06-16T19:06:15+07:00", "updated_at": "2021-06-16T19:09:58+07:00", "last_entry_id": 459 }, "feeds": [ { "created_at": "2021-06-19T07:00:11+07:00", "entry_id": 1, "field1": "26.51" }, { "created_at": "2021-06-19T07:00:26+07:00", "entry_id": 2, "field1": "26.78" }, { "created_at": "2021-06-19T07:00:56+07:00", "entry_id": 3, "field1": "26.81" } ] }'; $feeds = json_decode($json, true)['feeds']; usort($feeds, function($a, $b) { return $b['field1'] <=> $a['field1']; }); $last = array_slice($feeds, -1)[0]; printf( 'max : %.2f %s - min: %.2f %s', round($feeds[0]['field1'], 2), $feeds[0]['created_at'], round($last['field1'], 2), $last['created_at'] );
Output for 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.4, 8.3.6 - 8.3.26, 8.4.1 - 8.4.13
max : 26.81 2021-06-19T07:00:56+07:00 - min: 26.51 2021-06-19T07:00:11+07:00
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 max : 26.81 2021-06-19T07:00:56+07:00 - min: 26.51 2021-06-19T07:00:11+07:00

preferences:
139.59 ms | 407 KiB | 5 Q