3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { } (function(){echo 'foo';})->bindTo(new foo, foo::class)(); echo PHP_EOL . "____________________________________________________________" . PHP_EOL; class Wagon { private $name; public function __construct($name) { $this->name = $name; } } class bar { public $wagons; } $obj = new bar(); $obj->wagons = (function (Wagon ...$wagons) { return $wagons; })(new Wagon('Wagon1'), new Wagon('Wagon2')); var_dump($obj->wagons);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EGbIq
function name:  (null)
number of ops:  31
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEGbIq%3A7%240'
          1        INIT_METHOD_CALL                                         ~1, 'bindTo'
          2        NEW                                              $2      'foo'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $2
          5        SEND_VAL_EX                                              'foo'
          6        DO_FCALL                                      0  $4      
          7        INIT_DYNAMIC_CALL                                        $4
          8        DO_FCALL                                      0          
    9     9        ECHO                                                     '%0A____________________________________________________________%0A'
   27    10        NEW                                              $6      'bar'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !0, $6
   29    13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEGbIq%3A29%241'
   31    14        INIT_DYNAMIC_CALL                                        ~10
         15        NEW                                              $11     'Wagon'
         16        SEND_VAL_EX                                              'Wagon1'
         17        DO_FCALL                                      0          
         18        SEND_VAR_NO_REF_EX                                       $11
         19        NEW                                              $13     'Wagon'
         20        SEND_VAL_EX                                              'Wagon2'
         21        DO_FCALL                                      0          
         22        SEND_VAR_NO_REF_EX                                       $13
         23        DO_FCALL                                      0  $15     
   29    24        ASSIGN_OBJ                                               !0, 'wagons'
   31    25        OP_DATA                                                  $15
   33    26        INIT_FCALL                                               'var_dump'
         27        FETCH_OBJ_R                                      ~16     !0, 'wagons'
         28        SEND_VAL                                                 ~16
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FEGbIq%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EGbIq
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'foo'
          1      > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2FEGbIq%3A29%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EGbIq
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $wagons
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV_VARIADIC                                    !0      
   30     1      > RETURN                                                   !0
   31     2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FEGbIq%3A29%241

Class foo: [no user functions]
Class Wagon:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EGbIq
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function __construct

End of class Wagon.

Class bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.32 ms | 1400 KiB | 15 Q