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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WdO6i
function name:  (null)
number of ops:  18
compiled vars:  !0 = $json, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A++++%22id%22%3A+%22220%22%2C%0A++++%22pin_list%22%3A+%5B%0A++++++++%7B%0A++++++++++++%22id%22%3A+%221%22%2C%0A++++++++++++%22name%22%3A+%221.+La+Sagrada+Familia%22%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++++%22id%22%3A+%222%22%2C%0A++++++++++++%22name%22%3A+%222.+Park+Guell%22%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++++%22id%22%3A+%223%22%2C%0A++++++++++++%22name%22%3A+%2210.+Casa+Batllo%22%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++++%22id%22%3A+%224%22%2C%0A++++++++++++%22name%22%3A+%2211.+Cathedral+of+Barcelona%22%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++++%22id%22%3A+%225%22%2C%0A++++++++++++%22name%22%3A+%223.+Picasso+Museum%22%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++++%22id%22%3A+%226%22%2C%0A++++++++++++%22name%22%3A+%22Zebra%22%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++++%22id%22%3A+%227%22%2C%0A++++++++++++%22name%22%3A+%22Apple%22%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++++%22id%22%3A+%228%22%2C%0A++++++++++++%22name%22%3A+%22Monkey%22%0A++++++++%7D%0A++++%5D%0A%7D'
   40     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   41     6        INIT_FCALL                                               'usort'
          7        FETCH_DIM_W                                      $5      !1, 'pin_list'
          8        SEND_REF                                                 $5
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWdO6i%3A41%240'
   43    10        SEND_VAL                                                 ~6
         11        DO_ICALL                                                 
   44    12        INIT_FCALL                                               'json_encode'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 128
         15        DO_ICALL                                         $8      
         16        ECHO                                                     $8
         17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FWdO6i%3A41%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WdO6i
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   42     2        INIT_FCALL                                               'strnatcmp'
          3        FETCH_DIM_R                                      ~2      !0, 'name'
          4        SEND_VAL                                                 ~2
          5        FETCH_DIM_R                                      ~3      !1, 'name'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
   43     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FWdO6i%3A41%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.53 ms | 1400 KiB | 21 Q