3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Some { private $callback; public function __construct(\Closure $callMyBabyBack) { $this->callback = $callMyBabyBack; } public function work() { $callback = $this->callback; $callback(); } } $some = new Some(function(){ echo "working..."; }); $some->work();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QYdWs
function name:  (null)
number of ops:  8
compiled vars:  !0 = $some
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $1      'Some'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FQYdWs%3A31%240'
   33     2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
   31     4        ASSIGN                                                   !0, $1
   36     5        INIT_METHOD_CALL                                         !0, 'work'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FQYdWs%3A31%240

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

End of function __construct

Function work:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QYdWs
function name:  work
number of ops:  5
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~1      'callback'
          1        ASSIGN                                                   !0, ~1
   22     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0          
   23     4      > RETURN                                                   null

End of function work

End of class Some.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.66 ms | 1395 KiB | 13 Q