3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getVar(&$var) { $tmp = $var; // store the variable value $var = '_$_%&33xc$%^*7_r4'; // give the variable a new unique value $name = array_search($var, $GLOBALS); // search $GLOBALS for that unique value and return the key(variable) $var = $tmp; // restore the variable old value return $name; } $city = "San Francisco"; $age = 55; $object = new Stdclass; $arr = array(3, 5, 6); echo getVar($city). PHP_EOL; echo getVar($age). PHP_EOL; echo getVar($object). PHP_EOL; echo getVar($arr). PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UMW7V
function name:  (null)
number of ops:  27
compiled vars:  !0 = $city, !1 = $age, !2 = $object, !3 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 'San+Francisco'
   11     1        ASSIGN                                                   !1, 55
   12     2        NEW                                              $6      'Stdclass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $6
   13     5        ASSIGN                                                   !3, <array>
   15     6        INIT_FCALL                                               'getvar'
          7        SEND_REF                                                 !0
          8        DO_FCALL                                      0  $10     
          9        CONCAT                                           ~11     $10, '%0A'
         10        ECHO                                                     ~11
   16    11        INIT_FCALL                                               'getvar'
         12        SEND_REF                                                 !1
         13        DO_FCALL                                      0  $12     
         14        CONCAT                                           ~13     $12, '%0A'
         15        ECHO                                                     ~13
   17    16        INIT_FCALL                                               'getvar'
         17        SEND_REF                                                 !2
         18        DO_FCALL                                      0  $14     
         19        CONCAT                                           ~15     $14, '%0A'
         20        ECHO                                                     ~15
   18    21        INIT_FCALL                                               'getvar'
         22        SEND_REF                                                 !3
         23        DO_FCALL                                      0  $16     
         24        CONCAT                                           ~17     $16, '%0A'
         25        ECHO                                                     ~17
   19    26      > RETURN                                                   1

Function getvar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UMW7V
function name:  getVar
number of ops:  12
compiled vars:  !0 = $var, !1 = $tmp, !2 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, !0
    4     2        ASSIGN                                                   !0, '_%24_%25%2633xc%24%25%5E%2A7_r4'
    5     3        INIT_FCALL                                               'array_search'
          4        SEND_VAR                                                 !0
          5        FETCH_R                      global              ~5      'GLOBALS'
          6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !2, $6
    6     9        ASSIGN                                                   !0, !1
    7    10      > RETURN                                                   !2
    8    11*     > RETURN                                                   null

End of function getvar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.61 ms | 1399 KiB | 19 Q