3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { protected $bar = 'A bar'; public function getBarDumper() { $that = $this; return function() { var_dump($this->bar); }; } public static function getFactory() { // la fonction anonyme suivante est statique // car elle est déclarée dans une méthode statique. return function() { var_dump($this); return new static(); }; } } class bar {} $factory = foo::getFactory(); $bar = new bar(); $factory = $factory->bindTo($bar, $bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VkojJ
function name:  (null)
number of ops:  12
compiled vars:  !0 = $factory, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_STATIC_METHOD_CALL                                  'foo', 'getFactory'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   23     3        NEW                                              $4      'bar'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $4
   24     6        INIT_METHOD_CALL                                         !0, 'bindTo'
          7        SEND_VAR_EX                                              !1
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $7      
         10        ASSIGN                                                   !0, $7
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FVkojJ%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VkojJ
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_THIS                                       $0      
          2        FETCH_OBJ_R                                      ~1      $0, 'bar'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
          5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FVkojJ%3A9%240

Function %00%7Bclosure%7D%2Fin%2FVkojJ%3A16%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VkojJ
function name:  {closure}
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
          4        NEW                          static              $2      
          5        DO_FCALL                                      0          
          6      > RETURN                                                   $2
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FVkojJ%3A16%241

Class foo:
Function getbardumper:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VkojJ
function name:  getBarDumper
number of ops:  5
compiled vars:  !0 = $that
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_THIS                                       ~1      
          1        ASSIGN                                                   !0, ~1
    9     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVkojJ%3A9%240'
          3      > RETURN                                                   ~3
   10     4*     > RETURN                                                   null

End of function getbardumper

Function getfactory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VkojJ
function name:  getFactory
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVkojJ%3A16%241'
          1      > RETURN                                                   ~0
   17     2*     > RETURN                                                   null

End of function getfactory

End of class foo.

Class bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.67 ms | 1400 KiB | 15 Q