3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Promise { public $value; public function __construct($value) { $this->value = $value; } public function when(callable $callable) { $value = $this->value; $callable($value); } } $promise = new Promise(new StdClass); var_dump($promise); $promise->when(function(&$when) { $when = 42; }); var_dump($promise);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vZM0p
function name:  (null)
number of ops:  17
compiled vars:  !0 = $promise
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'Promise'
          1        NEW                                              $2      'StdClass'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   18     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   20     9        INIT_METHOD_CALL                                         !0, 'when'
         10        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
   22    11        SEND_VAL_EX                                              ~7
   20    12        DO_FCALL                                      0          
   24    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vZM0p
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $when
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        ASSIGN                                                   !0, 42
   22     2      > RETURN                                                   null

End of Dynamic Function 0

Class Promise:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vZM0p
function name:  __construct
number of ops:  4
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ                                               'value'
          2        OP_DATA                                                  !0
    8     3      > RETURN                                                   null

End of function __construct

Function when:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vZM0p
function name:  when
number of ops:  7
compiled vars:  !0 = $callable, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~2      'value'
          2        ASSIGN                                                   !1, ~2
   12     3        INIT_DYNAMIC_CALL                                        !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
   13     6      > RETURN                                                   null

End of function when

End of class Promise.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.44 ms | 1003 KiB | 14 Q