3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'name' => 'Foo', 'children' => [ [ 'name' => 'B', 'children' => [] ], [ 'name' => 'A', 'children' => [] ] ] ], [ 'name' => 'Bar', 'children' => [ [ 'name' => 'Z', 'children' => [] ], [ 'name' => 'X', 'children' => [] ], [ 'name' => 'Y', 'children' => [] ] ] ] ]; array_usort($array, $f = function(&$x, &$y) use (&$f){ array_usort($x['children'], $f); array_usort($y['children'], $f); return strcasecmp($x['name'], $y['name']); }); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/55FF6
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   36     1        INIT_FCALL_BY_NAME                                       'array_usort'
          2        SEND_VAR_EX                                              !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F55FF6%3A36%240'
          4        BIND_LEXICAL                                             ~3, !1
          5        ASSIGN                                           ~4      !1, ~3
          6        SEND_VAL_EX                                              ~4
          7        DO_FCALL                                      0          
   42     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F55FF6%3A36%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/55FF6
function name:  {closure}
number of ops:  23
compiled vars:  !0 = $x, !1 = $y, !2 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   37     3        INIT_FCALL_BY_NAME                                       'array_usort'
          4        CHECK_FUNC_ARG                                           
          5        FETCH_DIM_FUNC_ARG                               $3      !0, 'children'
          6        SEND_FUNC_ARG                                            $3
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
   38     9        INIT_FCALL_BY_NAME                                       'array_usort'
         10        CHECK_FUNC_ARG                                           
         11        FETCH_DIM_FUNC_ARG                               $5      !1, 'children'
         12        SEND_FUNC_ARG                                            $5
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
   39    15        INIT_FCALL                                               'strcasecmp'
         16        FETCH_DIM_R                                      ~7      !0, 'name'
         17        SEND_VAL                                                 ~7
         18        FETCH_DIM_R                                      ~8      !1, 'name'
         19        SEND_VAL                                                 ~8
         20        DO_ICALL                                         $9      
         21      > RETURN                                                   $9
   40    22*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F55FF6%3A36%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.57 ms | 1396 KiB | 17 Q