3v4l.org

run code in 300+ PHP versions simultaneously
<?php function printForTest($a, $b) { var_dump($a); var_dump($b); var_dump (spl_object_hash($a) === spl_object_hash($b) ); print "\n"; } $a = new stdClass; $b = $a; $a->foo = "bar"; list ($cachedA, $cachedB) = unserialize(serialize([$a, $b])); $cachedA->hello = "world"; printForTest($cachedA, $cachedB); unset($cachedA, $cachedB); $cachedA = unserialize(serialize($a)); $cachedB = unserialize(serialize($b)); $cachedA->hello = "world"; printForTest($cachedA, $cachedB);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/71rX8
function name:  (null)
number of ops:  48
compiled vars:  !0 = $a, !1 = $b, !2 = $cachedA, !3 = $cachedB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $4      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   11     3        ASSIGN                                                   !1, !0
   13     4        ASSIGN_OBJ                                               !0, 'foo'
          5        OP_DATA                                                  'bar'
   15     6        INIT_FCALL                                               'unserialize'
          7        INIT_FCALL                                               'serialize'
          8        INIT_ARRAY                                       ~9      !0
          9        ADD_ARRAY_ELEMENT                                ~9      !1
         10        SEND_VAL                                                 ~9
         11        DO_ICALL                                         $10     
         12        SEND_VAR                                                 $10
         13        DO_ICALL                                         $11     
         14        FETCH_LIST_R                                     $12     $11, 0
         15        ASSIGN                                                   !2, $12
         16        FETCH_LIST_R                                     $14     $11, 1
         17        ASSIGN                                                   !3, $14
         18        FREE                                                     $11
   16    19        ASSIGN_OBJ                                               !2, 'hello'
         20        OP_DATA                                                  'world'
   17    21        INIT_FCALL                                               'printfortest'
         22        SEND_VAR                                                 !2
         23        SEND_VAR                                                 !3
         24        DO_FCALL                                      0          
   19    25        UNSET_CV                                                 !2
         26        UNSET_CV                                                 !3
   20    27        INIT_FCALL                                               'unserialize'
         28        INIT_FCALL                                               'serialize'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $18     
         31        SEND_VAR                                                 $18
         32        DO_ICALL                                         $19     
         33        ASSIGN                                                   !2, $19
   21    34        INIT_FCALL                                               'unserialize'
         35        INIT_FCALL                                               'serialize'
         36        SEND_VAR                                                 !1
         37        DO_ICALL                                         $21     
         38        SEND_VAR                                                 $21
         39        DO_ICALL                                         $22     
         40        ASSIGN                                                   !3, $22
   22    41        ASSIGN_OBJ                                               !2, 'hello'
         42        OP_DATA                                                  'world'
   23    43        INIT_FCALL                                               'printfortest'
         44        SEND_VAR                                                 !2
         45        SEND_VAR                                                 !3
         46        DO_FCALL                                      0          
         47      > RETURN                                                   1

Function printfortest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/71rX8
function name:  printForTest
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    5     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
    6     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'spl_object_hash'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $4      
         12        INIT_FCALL                                               'spl_object_hash'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $5      
         15        IS_IDENTICAL                                     ~6      $4, $5
         16        SEND_VAL                                                 ~6
         17        DO_ICALL                                                 
    7    18        ECHO                                                     '%0A'
    8    19      > RETURN                                                   null

End of function printfortest

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.12 ms | 1394 KiB | 23 Q