3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_map_key(Callable $callback, $array) { $return = array(); foreach ($array as $key => $value) { list($k,$v) = $callback($key, $value); $return[$k] = $v; } return $return; } function my_call_back($key, $value) { return array($value, strlen($value)); } $array = explode(" ", "PHP stands for PHP hypertext preprocessor"); $array = array_map_key('my_call_back', $array); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JT1nW
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'explode'
          1        SEND_VAL                                                 '+'
          2        SEND_VAL                                                 'PHP+stands+for+PHP+hypertext+preprocessor'
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   19     5        INIT_FCALL                                               'array_map_key'
          6        SEND_VAL                                                 'my_call_back'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $3      
          9        ASSIGN                                                   !0, $3
   21    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function array_map_key:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/JT1nW
function name:  array_map_key
number of ops:  21
compiled vars:  !0 = $callback, !1 = $array, !2 = $return, !3 = $value, !4 = $key, !5 = $k, !6 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        ASSIGN                                                   !2, <array>
    5     3      > FE_RESET_R                                       $8      !1, ->18
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->18
          5    >   ASSIGN                                                   !4, ~9
    6     6        INIT_DYNAMIC_CALL                                        !0
          7        SEND_VAR_EX                                              !4
          8        SEND_VAR_EX                                              !3
          9        DO_FCALL                                      0  $11     
         10        FETCH_LIST_R                                     $12     $11, 0
         11        ASSIGN                                                   !5, $12
         12        FETCH_LIST_R                                     $14     $11, 1
         13        ASSIGN                                                   !6, $14
         14        FREE                                                     $11
    7    15        ASSIGN_DIM                                               !2, !5
         16        OP_DATA                                                  !6
    5    17      > JMP                                                      ->4
         18    >   FE_FREE                                                  $8
   10    19      > RETURN                                                   !2
   11    20*     > RETURN                                                   null

End of function array_map_key

Function my_call_back:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JT1nW
function name:  my_call_back
number of ops:  7
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        INIT_ARRAY                                       ~2      !1
          3        STRLEN                                           ~3      !1
          4        ADD_ARRAY_ELEMENT                                ~2      ~3
          5      > RETURN                                                   ~2
   16     6*     > RETURN                                                   null

End of function my_call_back

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.27 ms | 1468 KiB | 16 Q