3v4l.org

run code in 500+ PHP versions simultaneously
<?php function set_name($name) { $GLOBALS['name'] = $name; } function get_name() { return $GLOBALS['name']; /* Above line is equal to: * global $name; * return $name; */ } function wrap($txt) { echo 'Your username is ' . get_name() . ' ' . $txt; } /* You should not print/echo stuff in a function. So the better way would be: * function wrap($txt) { * return 'Your username is ' . get_name() . $txt; * } * echo wrap($txt) */ // Usage: set_name('Rajitha'); wrap('tobacco');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m4D4l
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                                   'set_name'
          1        SEND_VAL                                                     'Rajitha'
          2        DO_FCALL                                          0          
   29     3        INIT_FCALL                                                   'wrap'
          4        SEND_VAL                                                     'tobacco'
          5        DO_FCALL                                          0          
          6      > RETURN                                                       1

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

End of function set_name

Function get_name:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m4D4l
function name:  get_name
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   FETCH_R                          global              ~0      'name'
          1      > RETURN                                                       ~0
   12     2*     > RETURN                                                       null

End of function get_name

Function wrap:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m4D4l
function name:  wrap
number of ops:  8
compiled vars:  !0 = $txt
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
   15     1        INIT_FCALL                                                   'get_name'
          2        DO_FCALL                                          0  $1      
          3        CONCAT                                               ~2      'Your+username+is+', $1
          4        CONCAT                                               ~3      ~2, '+'
          5        CONCAT                                               ~4      ~3, !0
          6        ECHO                                                         ~4
   16     7      > RETURN                                                       null

End of function wrap

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.09 ms | 3112 KiB | 16 Q