3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Canary extends stdClass { public function __construct(public string $name) { } function __destruct() { echo $this->name."\n"; } } $canary = new Canary('canary'); $map = new \WeakMap(); $map[$canary] = 'foo'; echo 1; unset($canary); echo 2;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ic0YC
function name:  (null)
number of ops:  13
compiled vars:  !0 = $canary, !1 = $map
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'Canary'
          1        SEND_VAL_EX                                              'canary'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   17     4        NEW                                              $5      'WeakMap'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   18     7        ASSIGN_DIM                                               !1, !0
          8        OP_DATA                                                  'foo'
   20     9        ECHO                                                     1
   21    10        UNSET_CV                                                 !0
   22    11        ECHO                                                     2
   23    12      > RETURN                                                   1

Class Canary:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ic0YC
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
    7     3      > 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/Ic0YC
function name:  __destruct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        CONCAT                                           ~1      ~0, '%0A'
          2        ECHO                                                     ~1
   12     3      > RETURN                                                   null

End of function __destruct

End of class Canary.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.83 ms | 1394 KiB | 13 Q