3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = [ 'this' => 'that', 'and' => 'the', 'other' => (object) [ 'layers' => 'make', 'things' => 'more', 'fun' => (object) [ 'every' => 'time', 'foo' => 'bar', ], ], ]; // Just sort and return the sorted array function array_ksort(array $array) { ksort($array); return $array; } $obj = (object) array_ksort(array_map(function($value) { return !is_object($value) ? $value : (object) array_ksort((array) $value);}, $obj)); var_dump($obj);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2hZsB
function name:  (null)
number of ops:  23
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_ARRAY                                       ~1      'that', 'this'
    5     1        ADD_ARRAY_ELEMENT                                ~1      'the', 'and'
    7     2        INIT_ARRAY                                       ~2      'make', 'layers'
    8     3        ADD_ARRAY_ELEMENT                                ~2      'more', 'things'
   10     4        CAST                                          8  ~3      <array>
          5        ADD_ARRAY_ELEMENT                                ~2      ~3, 'fun'
          6        CAST                                          8  ~4      ~2
          7        ADD_ARRAY_ELEMENT                                ~1      ~4, 'other'
    3     8        ASSIGN                                                   !0, ~1
   22     9        INIT_FCALL                                               'array_ksort'
         10        INIT_FCALL                                               'array_map'
         11        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
         12        SEND_VAL                                                 ~6
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
         16        DO_FCALL                                      0  $8      
         17        CAST                                          8  ~9      $8
         18        ASSIGN                                                   !0, ~9
   23    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
         22      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2hZsB
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        TYPE_CHECK                                  256  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      !0
          5      > JMP                                                      ->12
          6    >   INIT_FCALL                                               'array_ksort'
          7        CAST                                          7  ~4      !0
          8        SEND_VAL                                                 ~4
          9        DO_FCALL                                      0  $5      
         10        CAST                                          8  ~6      $5
         11        QM_ASSIGN                                        ~3      ~6
         12    > > RETURN                                                   ~3
         13*     > RETURN                                                   null

End of Dynamic Function 0

Function array_ksort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2hZsB
function name:  array_ksort
number of ops:  6
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'ksort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
   19     4      > RETURN                                                   !0
   20     5*     > RETURN                                                   null

End of function array_ksort

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.25 ms | 1011 KiB | 18 Q