3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyQuery{ public function query() { die('callable called'); } } class QueryHandler { public $query; public function setQuery(callable $query) { echo "checkpoint 1 reached"."\n"; $this->query = $query; } public function runQuery(){ $this->$query(); echo "end (should not show)"."\n"; } } echo "start"."\n"; $myQuery = new MyQuery; $queryHandler = new QueryHandler; $queryHandler->setQuery($myQuery->query); $queryHandler->runQuery();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9TgDG
function name:  (null)
number of ops:  15
compiled vars:  !0 = $myQuery, !1 = $queryHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   ECHO                                                     'start%0A'
   35     1        NEW                                              $2      'MyQuery'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   36     4        NEW                                              $5      'QueryHandler'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   37     7        INIT_METHOD_CALL                                         !1, 'setQuery'
          8        CHECK_FUNC_ARG                                           
          9        FETCH_OBJ_FUNC_ARG                               $8      !0, 'query'
         10        SEND_FUNC_ARG                                            $8
         11        DO_FCALL                                      0          
   38    12        INIT_METHOD_CALL                                         !1, 'runQuery'
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1

Class MyQuery:
Function query:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/9TgDG
function name:  query
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > EXIT                                                     'callable+called'
    8     1*     > RETURN                                                   null

End of function query

End of class MyQuery.

Class QueryHandler:
Function setquery:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9TgDG
function name:  setQuery
number of ops:  5
compiled vars:  !0 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ECHO                                                     'checkpoint+1+reached%0A'
   21     2        ASSIGN_OBJ                                               'query'
          3        OP_DATA                                                  !0
   23     4      > RETURN                                                   null

End of function setquery

Function runquery:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9TgDG
function name:  runQuery
number of ops:  4
compiled vars:  !0 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_METHOD_CALL                                         !0
          1        DO_FCALL                                      0          
   28     2        ECHO                                                     'end+%28should+not+show%29%0A'
   29     3      > RETURN                                                   null

End of function runquery

End of class QueryHandler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.57 ms | 1395 KiB | 13 Q