3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $privateProperty = "hello"; public function myMethod() { $c = function($value) { return $that->privateProperty." ".$value; }; $d = $c->bindTo($this); $that = &$this; $map = array_map( $d, array( "city", "world", "universe" ) ); return $map; } } $test = new Test(); print_r($test->myMethod());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3NZel
function name:  (null)
number of ops:  9
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        INIT_FCALL                                               'print_r'
          4        INIT_METHOD_CALL                                         !0, 'myMethod'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2F3NZel%3A7%240

Class Test:
Function mymethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3NZel
function name:  myMethod
number of ops:  16
compiled vars:  !0 = $c, !1 = $d, !2 = $that, !3 = $map
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3NZel%3A7%240'
          1        ASSIGN                                                   !0, ~4
   10     2        INIT_METHOD_CALL                                         !0, 'bindTo'
          3        FETCH_THIS                                       $6      
          4        SEND_VAR_EX                                              $6
          5        DO_FCALL                                      0  $7      
          6        ASSIGN                                                   !1, $7
   11     7        FETCH_THIS                                       $9      
          8        ASSIGN_REF                                               !2, $9
   12     9        INIT_FCALL                                               'array_map'
   13    10        SEND_VAR                                                 !1
   15    11        SEND_VAL                                                 <array>
         12        DO_ICALL                                         $11     
   12    13        ASSIGN                                                   !3, $11
   20    14      > RETURN                                                   !3
   21    15*     > RETURN                                                   null

End of function mymethod

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.02 ms | 1396 KiB | 17 Q