3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getData() { return array('foo' => 42); } function a() { return eval('return (($data = getData()), $data["foo"]);'); } function b() { return eval('return getData()["foo"];'); } var_dump(a()); var_dump(b()); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u49ve
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'a'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
   15     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'b'
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
   16    10      > RETURN                                                   1

Function getdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u49ve
function name:  getData
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   <array>
    4     1*     > RETURN                                                   null

End of function getdata

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u49ve
function name:  a
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INCLUDE_OR_EVAL                                  $0      'return+%28%28%24data+%3D+getData%28%29%29%2C+%24data%5B%22foo%22%5D%29%3B', EVAL
          1      > RETURN                                                   $0
    8     2*     > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u49ve
function name:  b
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INCLUDE_OR_EVAL                                  $0      'return+getData%28%29%5B%22foo%22%5D%3B', EVAL
          1      > RETURN                                                   $0
   12     2*     > RETURN                                                   null

End of function b

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.71 ms | 1403 KiB | 17 Q