3v4l.org

run code in 300+ 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('efs'); wrap('tobacco');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qsQPH
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                                                 'efs'
          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/qsQPH
function name:  set_name
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        FETCH_W                      global              $1      'GLOBALS'
          2        ASSIGN_DIM                                               $1, 'name'
          3        OP_DATA                                                  !0
    4     4      > 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/qsQPH
function name:  get_name
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_R                      global              ~0      'GLOBALS'
          1        FETCH_DIM_R                                      ~1      ~0, 'name'
          2      > RETURN                                                   ~1
   12     3*     > 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/qsQPH
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.0.0


preferences:
162.91 ms | 1399 KiB | 16 Q