3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $resource; public function __construct($path) { $this->resource = fopen($path, 'rb'); } public function __destruct() { fwrite(STDOUT, sprintf('BYE BYE %s%s', get_class($this), PHP_EOL)); } } class Bar { private $cl; private $resource; public function __construct($path) { $this->resource = fopen($path, 'rb'); $this->cl = function () {}; } public function __destruct() { fwrite(STDOUT, sprintf('BYE BYE %s%s', get_class($this), PHP_EOL)); } } function get_path($resource) { $ctx = stream_get_meta_data($resource); return $ctx['uri']; } $foo = new Foo(__FILE__); $bar = new Bar(__FILE__); unset($bar); unset($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gufL
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $2      'Foo'
          1        SEND_VAL_EX                                              '%2Fin%2F7gufL'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   32     4        NEW                                              $5      'Bar'
          5        SEND_VAL_EX                                              '%2Fin%2F7gufL'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   34     8        UNSET_CV                                                 !1
   35     9        UNSET_CV                                                 !0
         10      > RETURN                                                   1

Function get_path:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gufL
function name:  get_path
number of ops:  8
compiled vars:  !0 = $resource, !1 = $ctx
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        INIT_FCALL                                               'stream_get_meta_data'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   27     5        FETCH_DIM_R                                      ~4      !1, 'uri'
          6      > RETURN                                                   ~4
   28     7*     > RETURN                                                   null

End of function get_path

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gufL
function name:  __construct
number of ops:  8
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'fopen'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'rb'
          4        DO_ICALL                                         $2      
          5        ASSIGN_OBJ                                               'resource'
          6        OP_DATA                                                  $2
    7     7      > 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/7gufL
function name:  __destruct
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'fwrite'
          1        FETCH_CONSTANT                                   ~0      'STDOUT'
          2        SEND_VAL                                                 ~0
          3        INIT_FCALL                                               'sprintf'
          4        SEND_VAL                                                 'BYE+BYE+%25s%25s'
          5        FETCH_THIS                                       ~1      
          6        GET_CLASS                                        ~2      ~1
          7        SEND_VAL                                                 ~2
          8        SEND_VAL                                                 '%0A'
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                                 
   10    12      > RETURN                                                   null

End of function __destruct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gufL
function name:  __construct
number of ops:  11
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'fopen'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'rb'
          4        DO_ICALL                                         $2      
          5        ASSIGN_OBJ                                               'resource'
          6        OP_DATA                                                  $2
   18     7        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          8        ASSIGN_OBJ                                               'cl'
          9        OP_DATA                                                  ~4
   19    10      > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gufL
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                   null

End of Dynamic Function 0

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gufL
function name:  __destruct
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'fwrite'
          1        FETCH_CONSTANT                                   ~0      'STDOUT'
          2        SEND_VAL                                                 ~0
          3        INIT_FCALL                                               'sprintf'
          4        SEND_VAL                                                 'BYE+BYE+%25s%25s'
          5        FETCH_THIS                                       ~1      
          6        GET_CLASS                                        ~2      ~1
          7        SEND_VAL                                                 ~2
          8        SEND_VAL                                                 '%0A'
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                                 
   23    12      > RETURN                                                   null

End of function __destruct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.38 ms | 1014 KiB | 17 Q