3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DbSwitcher { function __construct() { print "switch DB\n"; } function __destruct() { print "switch back\n"; } } function foo() { $switched = new DbSwitcher(); echo "do queries\n"; } foo(); foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2907o
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0          
   20     2        INIT_FCALL                                               'foo'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2907o
function name:  foo
number of ops:  5
compiled vars:  !0 = $switched
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'DbSwitcher'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   16     3        ECHO                                                     'do+queries%0A'
   17     4      > RETURN                                                   null

End of function foo

Class DbSwitcher:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2907o
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'switch+DB%0A'
    6     1      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2907o
function name:  __destruct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'switch+back%0A'
   10     1      > RETURN                                                   null

End of function __destruct

End of class DbSwitcher.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.73 ms | 1398 KiB | 15 Q