3v4l.org

run code in 300+ PHP versions simultaneously
<?php function machine_forget(&$data) { $data = null; } $answer = 42; var_dump((string)$answer); machine_forget($answer); var_dump((string)$answer); // shhh no spoilers class zombie { private $val; public function __construct($val) { $this->val = $val; } public function __destruct() { $this->vessel = $this; } public function __toString() { return $this->val; } } $answer = new zombie("42"); $answer->vessel = &$answer; var_dump((string)$answer); machine_forget($answer); var_dump((string)$answer);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ja9cK
function name:  (null)
number of ops:  31
compiled vars:  !0 = $answer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 42
    8     1        INIT_FCALL                                               'var_dump'
          2        CAST                                          6  ~2      !0
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                                 
    9     5        INIT_FCALL                                               'machine_forget'
          6        SEND_REF                                                 !0
          7        DO_FCALL                                      0          
   10     8        INIT_FCALL                                               'var_dump'
          9        CAST                                          6  ~5      !0
         10        SEND_VAL                                                 ~5
         11        DO_ICALL                                                 
   13    12        DECLARE_CLASS                                            'zombie'
   20    13        NEW                                              $7      'zombie'
         14        SEND_VAL_EX                                              '42'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !0, $7
   21    17        ASSIGN_OBJ_REF                                           !0, 'vessel'
         18        OP_DATA                                                  !0
   23    19        INIT_FCALL                                               'var_dump'
         20        CAST                                          6  ~11     !0
         21        SEND_VAL                                                 ~11
         22        DO_ICALL                                                 
   24    23        INIT_FCALL                                               'machine_forget'
         24        SEND_REF                                                 !0
         25        DO_FCALL                                      0          
   25    26        INIT_FCALL                                               'var_dump'
         27        CAST                                          6  ~14     !0
         28        SEND_VAL                                                 ~14
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function machine_forget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ja9cK
function name:  machine_forget
number of ops:  3
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !0, null
    5     2      > RETURN                                                   null

End of function machine_forget

Class zombie:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ja9cK
function name:  __construct
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'val'
          2        OP_DATA                                                  !0
          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/ja9cK
function name:  __destruct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_THIS                                       ~1      
          1        ASSIGN_OBJ                                               'vessel'
          2        OP_DATA                                                  ~1
          3      > RETURN                                                   null

End of function __destruct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ja9cK
function name:  __toString
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'val'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
          3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function __tostring

End of class zombie.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.94 ms | 1394 KiB | 17 Q