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/hBnIE
function name:  (null)
number of ops:  17
compiled vars:  !0 = $arr, !1 = $arr1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
   13     4        SEND_VAL                                                 ~3
   10     5        DO_ICALL                                                 
   15     6        ASSIGN                                                   !1, <array>
   16     7        INIT_FCALL                                               'array_walk'
          8        SEND_REF                                                 !0
          9        DECLARE_LAMBDA_FUNCTION                          ~6      [1]
         10        BIND_LEXICAL                                             ~6, !1
   18    11        SEND_VAL                                                 ~6
   16    12        DO_ICALL                                                 
   19    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
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/hBnIE
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     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
   12     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
   13    19*     > RETURN                                                   null

End of Dynamic Function 0

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

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
216.75 ms | 1088 KiB | 16 Q