3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php global $country_name; function get_country_code() { $cc = 'US'; return $cc; } function get_country_name() { $cn_array = array( 'COUNTRY_NAME' => array( 'AF' => 'Afghanistan', 'US' => 'United Snakes', 'RU' => 'VodkaTown', ), ); $country_code = 'US'; $country_name = $cn_array['COUNTRY_NAME'][$country_code]; } $country_name = get_country_name($country_name); echo $country_name;
based on jm2Mp
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/elnr9
function name:  (null)
number of ops:  9
compiled vars:  !0 = $country_name
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   BIND_GLOBAL                                              !0, 'country_name'
   5     1        NOP                                                      
  12     2        NOP                                                      
  28     3        INIT_FCALL                                               'get_country_name'
         4        SEND_VAR                                                 !0
         5        DO_FCALL                                      0  $1      
         6        ASSIGN                                                   !0, $1
  30     7        ECHO                                                     !0
         8      > RETURN                                                   1

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

End of function get_country_code

Function get_country_name:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/elnr9
function name:  get_country_name
number of ops:  6
compiled vars:  !0 = $cn_array, !1 = $country_code, !2 = $country_name
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   ASSIGN                                                   !0, <array>
  22     1        ASSIGN                                                   !1, 'US'
  24     2        FETCH_DIM_R                                      $5      !0, 'COUNTRY_NAME'
         3        FETCH_DIM_R                                      $6      $5, !1
         4        ASSIGN                                                   !2, $6
  25     5      > RETURN                                                   null

End of function get_country_name

Generated using Vulcan Logic Dumper, using php 7.3.0