3v4l.org

run code in 300+ PHP versions simultaneously
<?php $js = '{ "BHS": { "text": "Beacon Hill School", "optgroup": "Kowloon" }, "HSK": { "text": "ESF International Kindergarten (Hillside)", "optgroup": "Hong Kong Island" }, "KJS": { "text": "Kowloon Junior School", "optgroup": "Kowloon" } }'; $json = json_decode($js); function sortByText($a, $b) { return ord($a['text'][0]) - ord($b['text'][0]); } usort($json, 'sortByText'); var_dump($json);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7PTt
function name:  (null)
number of ops:  13
compiled vars:  !0 = $js, !1 = $json
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A++++++++++++%22BHS%22%3A+%7B%0A++++++++++++++++%22text%22%3A+%22Beacon+Hill+School%22%2C%0A++++++++++++++++%22optgroup%22%3A+%22Kowloon%22%0A++++++++++++%7D%2C%0A++++++++++++%22HSK%22%3A+%7B%0A++++++++++++++++%22text%22%3A+%22ESF+International+Kindergarten+%28Hillside%29%22%2C%0A++++++++++++++++%22optgroup%22%3A+%22Hong+Kong+Island%22%0A++++++++++++%7D%2C%0A++++++++++++%22KJS%22%3A+%7B%0A++++++++++++++++%22text%22%3A+%22Kowloon+Junior+School%22%2C%0A++++++++++++++++%22optgroup%22%3A+%22Kowloon%22%0A++++++++++++%7D%0A%7D'
   17     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   23     5        INIT_FCALL                                               'usort'
          6        SEND_REF                                                 !1
          7        SEND_VAL                                                 'sortByText'
          8        DO_ICALL                                                 
   25     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function sortbytext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7PTt
function name:  sortByText
number of ops:  15
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2        INIT_FCALL                                               'ord'
          3        FETCH_DIM_R                                      ~2      !0, 'text'
          4        FETCH_DIM_R                                      ~3      ~2, 0
          5        SEND_VAL                                                 ~3
          6        DO_ICALL                                         $4      
          7        INIT_FCALL                                               'ord'
          8        FETCH_DIM_R                                      ~5      !1, 'text'
          9        FETCH_DIM_R                                      ~6      ~5, 0
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        SUB                                              ~8      $4, $7
         13      > RETURN                                                   ~8
   21    14*     > RETURN                                                   null

End of function sortbytext

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.97 ms | 1396 KiB | 21 Q