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' => [] ] ] ] ]; usort($array, $f = function(&$x, &$y) use (&$f){ usort($x['children'], $f); usort($y['children'], $f); var_dump($x['children']); 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/r4mhZ
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                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fr4mhZ%3A36%240'
          4        BIND_LEXICAL                                             ~3, !1
          5        ASSIGN                                           ~4      !1, ~3
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
   43     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fr4mhZ%3A36%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r4mhZ
function name:  {closure}
number of ops:  25
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                                               'usort'
          4        FETCH_DIM_W                                      $3      !0, 'children'
          5        SEND_REF                                                 $3
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                                 
   38     8        INIT_FCALL                                               'usort'
          9        FETCH_DIM_W                                      $5      !1, 'children'
         10        SEND_REF                                                 $5
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   39    13        INIT_FCALL                                               'var_dump'
         14        FETCH_DIM_R                                      ~7      !0, 'children'
         15        SEND_VAL                                                 ~7
         16        DO_ICALL                                                 
   40    17        INIT_FCALL                                               'strcasecmp'
         18        FETCH_DIM_R                                      ~9      !0, 'name'
         19        SEND_VAL                                                 ~9
         20        FETCH_DIM_R                                      ~10     !1, 'name'
         21        SEND_VAL                                                 ~10
         22        DO_ICALL                                         $11     
         23      > RETURN                                                   $11
   41    24*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.91 ms | 1396 KiB | 19 Q