3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Adapted from last example on http://nikic.github.io/2015/05/05/Internal-value-representation-in-PHP-7-part-1 $a = array(); // $a -> zend_array_1(refcount=1, value=[]) $b = $a; // $a, $b, -> zend_array_1(refcount=2, value=[]) $c = $b; // $a, $b, $c -> zend_array_1(refcount=3, value=[]) $x = $c; // $a, $b, $c, $x -> zend_array_1(refcount=4, value=[]) $d =& $c; $y =& $d; // $a, $b, $x -> zend_array_1(refcount=4, value=[]) // $c, $d, $y -> zend_reference_1(refcount=3) ---^ echo "Before\n"; debug_zval_dump($a); debug_zval_dump($b); debug_zval_dump($c); debug_zval_dump($d); $d[] = 1; // $a, $b, $x -> zend_array_1(refcount=3, value=[]) // $c, $d, $y -> zend_reference_1(refcount=3) -> zend_array_2(refcount=1, value=[1]) echo "After\n"; debug_zval_dump($a); debug_zval_dump($b); debug_zval_dump($c); debug_zval_dump($d);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NejOM
function name:  (null)
number of ops:  35
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $x, !4 = $d, !5 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, !0
    7     2        ASSIGN                                                   !2, !1
    8     3        ASSIGN                                                   !3, !2
   10     4        ASSIGN_REF                                               !4, !2
   11     5        ASSIGN_REF                                               !5, !4
   14     6        ECHO                                                     'Before%0A'
   15     7        INIT_FCALL                                               'debug_zval_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   16    10        INIT_FCALL                                               'debug_zval_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   17    13        INIT_FCALL                                               'debug_zval_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   18    16        INIT_FCALL                                               'debug_zval_dump'
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                                 
   20    19        ASSIGN_DIM                                               !4
         20        OP_DATA                                                  1
   23    21        ECHO                                                     'After%0A'
   24    22        INIT_FCALL                                               'debug_zval_dump'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
   25    25        INIT_FCALL                                               'debug_zval_dump'
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                                 
   26    28        INIT_FCALL                                               'debug_zval_dump'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
   27    31        INIT_FCALL                                               'debug_zval_dump'
         32        SEND_VAR                                                 !4
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.84 ms | 999 KiB | 14 Q