3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestMap { public function prepare($array, $fields) { $map = $this; return array_map(function ($item) use ($map, $fields) { return $map->norm($item,$fields); }, $array ); } protected function norm($array, $fields) { unset($array['test']); return $array; } } $test = new TestMap; print_r($test->prepare(array(array('id'=>1, 'test'=>'testing')), array()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bl72l
function name:  (null)
number of ops:  11
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'TestMap'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_FCALL                                               'print_r'
          4        INIT_METHOD_CALL                                         !0, 'prepare'
          5        SEND_VAL_EX                                              <array>
          6        SEND_VAL_EX                                              <array>
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FBl72l%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bl72l
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $item, !1 = $map, !2 = $fields
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    9     3        INIT_METHOD_CALL                                         !1, 'norm'
          4        SEND_VAR_EX                                              !0
          5        SEND_VAR_EX                                              !2
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   10     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBl72l%3A8%240

Class TestMap:
Function prepare:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bl72l
function name:  prepare
number of ops:  13
compiled vars:  !0 = $array, !1 = $fields, !2 = $map
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        FETCH_THIS                                       ~3      
          3        ASSIGN                                                   !2, ~3
    8     4        INIT_FCALL                                               'array_map'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBl72l%3A8%240'
          6        BIND_LEXICAL                                             ~5, !2
          7        BIND_LEXICAL                                             ~5, !1
   10     8        SEND_VAL                                                 ~5
   11     9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $6      
         11      > RETURN                                                   $6
   13    12*     > RETURN                                                   null

End of function prepare

Function norm:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bl72l
function name:  norm
number of ops:  5
compiled vars:  !0 = $array, !1 = $fields
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        UNSET_DIM                                                !0, 'test'
   18     3      > RETURN                                                   !0
   19     4*     > RETURN                                                   null

End of function norm

End of class TestMap.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.16 ms | 1400 KiB | 17 Q