3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ ['id' => 0, 'name' => '10sdf'], ['id' => 0, 'name' => '12'], ['id' => 0, 'name' => 'aasdfbc'], ['id' => 0, 'name' => 'ada'], ['id' => 0, 'name' => 'asdfsdf'], ]; //排序 usort($arr, function ($a, $b) { if (strlen($a['name']) == strlen($b['name'])) return 0; return strlen($a['name']) < strlen($b['name']) ? -1 : 1; }); //修改key $arr1 = []; array_walk($arr, function ($v,$k) use ($arr1){ $arr1[$k+1] = $v; }); var_dump($arr1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NSblF
function name:  (null)
number of ops:  17
compiled vars:  !0 = $arr, !1 = $arr1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FNSblF%3A11%240'
   14     4        SEND_VAL                                                 ~3
          5        DO_ICALL                                                 
   16     6        ASSIGN                                                   !1, <array>
   17     7        INIT_FCALL                                               'array_walk'
          8        SEND_REF                                                 !0
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FNSblF%3A17%241'
         10        BIND_LEXICAL                                             ~6, !1
   19    11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
   20    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FNSblF%3A11%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NSblF
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        FETCH_DIM_R                                      ~2      !0, 'name'
          3        STRLEN                                           ~3      ~2
          4        FETCH_DIM_R                                      ~4      !1, 'name'
          5        STRLEN                                           ~5      ~4
          6        IS_EQUAL                                                 ~3, ~5
          7      > JMPZ                                                     ~6, ->9
          8    > > RETURN                                                   0
   13     9    >   FETCH_DIM_R                                      ~7      !0, 'name'
         10        STRLEN                                           ~8      ~7
         11        FETCH_DIM_R                                      ~9      !1, 'name'
         12        STRLEN                                           ~10     ~9
         13        IS_SMALLER                                               ~8, ~10
         14      > JMPZ                                                     ~11, ->17
         15    >   QM_ASSIGN                                        ~12     -1
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~12     1
         18    > > RETURN                                                   ~12
   14    19*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FNSblF%3A11%240

Function %00%7Bclosure%7D%2Fin%2FNSblF%3A17%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NSblF
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v, !1 = $k, !2 = $arr1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   18     3        ADD                                              ~3      !1, 1
          4        ASSIGN_DIM                                               !2, ~3
          5        OP_DATA                                                  !0
   19     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FNSblF%3A17%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.3 ms | 1400 KiB | 19 Q