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) { $callable($this->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/brmcI
function name:  (null)
number of ops:  17
compiled vars:  !0 = $promise
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     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
   17     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   19     9        INIT_METHOD_CALL                                         !0, 'when'
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FbrmcI%3A19%240'
   21    11        SEND_VAL_EX                                              ~7
         12        DO_FCALL                                      0          
   23    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FbrmcI%3A19%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/brmcI
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $when
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ASSIGN                                                   !0, 42
   21     2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FbrmcI%3A19%240

Class Promise:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/brmcI
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/brmcI
function name:  when
number of ops:  7
compiled vars:  !0 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_DYNAMIC_CALL                                        !0
          2        CHECK_FUNC_ARG                                           
          3        FETCH_OBJ_FUNC_ARG                               $1      'value'
          4        SEND_FUNC_ARG                                            $1
          5        DO_FCALL                                      0          
   12     6      > RETURN                                                   null

End of function when

End of class Promise.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.52 ms | 1400 KiB | 15 Q