3v4l.org

run code in 300+ PHP versions simultaneously
<?php function countRefs($var) { //ob_start(); debug_zval_dump($var); //preg_match('~refcount\((\d+)\)~', ob_get_clean(), $matches); //return $matches[1]; // - 4; } $a = 0; $a = &$a; echo countRefs($a); $a = &$a; echo countRefs($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PD0UK
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 0
   11     1        ASSIGN_REF                                               !0, !0
   12     2        INIT_FCALL                                               'countrefs'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
   13     6        ASSIGN_REF                                               !0, !0
   14     7        INIT_FCALL                                               'countrefs'
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0  $5      
         10        ECHO                                                     $5
         11      > RETURN                                                   1

Function countrefs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PD0UK
function name:  countRefs
number of ops:  5
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'debug_zval_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    8     4      > RETURN                                                   null

End of function countrefs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.99 ms | 1397 KiB | 17 Q