3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = [ 3 => 'a', 2 => 'b', 1 => 'a' ]; array_walk($test, fn(&$value, $key) => $value=['key'=>$key,'value'=>$value]); uasort($test, fn($a, $b) => $a['value'] <=> $b['value'] ?: $a['key'] <=> $b['key']); array_walk($test, fn(&$pair) => $pair=$pair['value']); var_dump($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FMirS
function name:  (null)
number of ops:  20
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'array_walk'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFMirS%3A9%240'
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   10     6        INIT_FCALL                                               'uasort'
          7        SEND_REF                                                 !0
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFMirS%3A10%241'
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                                 
   11    11        INIT_FCALL                                               'array_walk'
         12        SEND_REF                                                 !0
         13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFMirS%3A11%242'
         14        SEND_VAL                                                 ~6
         15        DO_ICALL                                                 
   13    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FFMirS%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FMirS
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_ARRAY                                       ~2      !1, 'key'
          3        ADD_ARRAY_ELEMENT                                ~2      !0, 'value'
          4        ASSIGN                                           ~3      !0, ~2
          5      > RETURN                                                   ~3
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFMirS%3A9%240

Function %00%7Bclosure%7D%2Fin%2FFMirS%3A10%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FMirS
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        FETCH_DIM_R                                      ~2      !0, 'value'
          3        FETCH_DIM_R                                      ~3      !1, 'value'
          4        SPACESHIP                                        ~4      ~2, ~3
          5        JMP_SET                                          ~5      ~4, ->10
          6        FETCH_DIM_R                                      ~6      !0, 'key'
          7        FETCH_DIM_R                                      ~7      !1, 'key'
          8        SPACESHIP                                        ~8      ~6, ~7
          9        QM_ASSIGN                                        ~5      ~8
         10      > RETURN                                                   ~5
         11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFMirS%3A10%241

Function %00%7Bclosure%7D%2Fin%2FFMirS%3A11%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FMirS
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $pair
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 'value'
          2        ASSIGN                                           ~2      !0, ~1
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFMirS%3A11%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.79 ms | 1400 KiB | 19 Q