3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ran = 0; class Foo { public function __destruct() { global $ran; $ran++; } } function bar(Foo $foo) { global $ran; echo "Bar $ran\n"; unset($foo); echo "Unset(bar) $ran\n"; } echo "Start $ran\n"; $f = new Foo(); echo "New $ran\n"; bar($f); echo "Bar(f) $ran\n"; unset($f); echo "unset(f) $ran\n"; bar(new Foo); echo "Bar(f) $ran\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9hbKX
function name:  (null)
number of ops:  34
compiled vars:  !0 = $ran, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0
   19     1        ROPE_INIT                                     3  ~4      'Start+'
          2        ROPE_ADD                                      1  ~4      ~4, !0
          3        ROPE_END                                      2  ~3      ~4, '%0A'
          4        ECHO                                                     ~3
   20     5        NEW                                              $6      'Foo'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
   21     8        ROPE_INIT                                     3  ~10     'New+'
          9        ROPE_ADD                                      1  ~10     ~10, !0
         10        ROPE_END                                      2  ~9      ~10, '%0A'
         11        ECHO                                                     ~9
   22    12        INIT_FCALL                                               'bar'
         13        SEND_VAR                                                 !1
         14        DO_FCALL                                      0          
   23    15        ROPE_INIT                                     3  ~14     'Bar%28f%29+'
         16        ROPE_ADD                                      1  ~14     ~14, !0
         17        ROPE_END                                      2  ~13     ~14, '%0A'
         18        ECHO                                                     ~13
   24    19        UNSET_CV                                                 !1
   25    20        ROPE_INIT                                     3  ~17     'unset%28f%29+'
         21        ROPE_ADD                                      1  ~17     ~17, !0
         22        ROPE_END                                      2  ~16     ~17, '%0A'
         23        ECHO                                                     ~16
   26    24        INIT_FCALL                                               'bar'
         25        NEW                                              $19     'Foo'
         26        DO_FCALL                                      0          
         27        SEND_VAR                                                 $19
         28        DO_FCALL                                      0          
   27    29        ROPE_INIT                                     3  ~23     'Bar%28f%29+'
         30        ROPE_ADD                                      1  ~23     ~23, !0
         31        ROPE_END                                      2  ~22     ~23, '%0A'
         32        ECHO                                                     ~22
         33      > RETURN                                                   1

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9hbKX
function name:  bar
number of ops:  12
compiled vars:  !0 = $foo, !1 = $ran
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        BIND_GLOBAL                                              !1, 'ran'
   14     2        ROPE_INIT                                     3  ~3      'Bar+'
          3        ROPE_ADD                                      1  ~3      ~3, !1
          4        ROPE_END                                      2  ~2      ~3, '%0A'
          5        ECHO                                                     ~2
   15     6        UNSET_CV                                                 !0
   16     7        ROPE_INIT                                     3  ~6      'Unset%28bar%29+'
          8        ROPE_ADD                                      1  ~6      ~6, !1
          9        ROPE_END                                      2  ~5      ~6, '%0A'
         10        ECHO                                                     ~5
   17    11      > RETURN                                                   null

End of function bar

Class Foo:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9hbKX
function name:  __destruct
number of ops:  3
compiled vars:  !0 = $ran
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_GLOBAL                                              !0, 'ran'
    8     1        PRE_INC                                                  !0
    9     2      > RETURN                                                   null

End of function __destruct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.95 ms | 1403 KiB | 15 Q