3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "The 'Wee, inline callables are sort of function things' "; class q {function foo($str) {return 'moo '.$str; } } var_dump(([new q, 'foo'])('cow')); echo "The 'Wow, we can just quote anything now'"; function bar( ) { return 'cow'; } var_dump('bar'( )); echo "The 'I'm amazed PHP doesn't mess this up' "; foreach ($Array = [[12 => 'Moo'], [13 => 'Cow']] as $Array) { var_dump($Array); } echo "The 'PHP Variables MUST NOT contain some symbols... for very soft values of MUST NOT' "; ${'$0a'} = 12; ${'0a'} = 13; var_dump(${'$0a'}); var_dump(${'0a'}); // $0a is invalid and $$0a is even more invalid, with spinkles echo "The 'Good luck and thanks for all the cows' "; @var_dump(0x2&${$Array=['cow'=>3]}['cow']); echo "The 'Hurrah BC breaks, if your program broke because of this you're a bad person' "; list($a[],$a[])=$a=[1,2]; var_dump($a);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/Xp12H
function name:  (null)
number of ops:  58
compiled vars:  !0 = $Array, !1 = $$0a, !2 = $0a, !3 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                     'The+%27Wee%2C+inline+callables+are+sort+of+function+things%27+'
    4     1        INIT_FCALL                                               'var_dump'
          2        NEW                                              $4      'q'
          3        DO_FCALL                                      0          
          4        INIT_ARRAY                                       ~6      $4
          5        ADD_ARRAY_ELEMENT                                ~6      'foo'
          6        INIT_DYNAMIC_CALL                                        ~6
          7        SEND_VAL_EX                                              'cow'
          8        DO_FCALL                                      0  $7      
          9        SEND_VAR                                                 $7
         10        DO_ICALL                                                 
    6    11        ECHO                                                     'The+%27Wow%2C+we+can+just+quote+anything+now%27'
    8    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'bar'
         14        DO_FCALL                                      0  $9      
         15        SEND_VAR                                                 $9
         16        DO_ICALL                                                 
   10    17        ECHO                                                     'The+%27I%27m+amazed+PHP+doesn%27t+mess+this+up%27+'
   11    18        ASSIGN                                           ~11     !0, <array>
         19      > FE_RESET_R                                       $12     ~11, ->25
         20    > > FE_FETCH_R                                               $12, !0, ->25
   12    21    >   INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
   11    24      > JMP                                                      ->20
         25    >   FE_FREE                                                  $12
   15    26        ECHO                                                     'The+%27PHP+Variables+MUST+NOT+contain+some+symbols...+for+very+soft+values+of+MUST+NOT%27+'
   16    27        ASSIGN                                                   !1, 12
         28        ASSIGN                                                   !2, 13
   17    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                                 
         32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                                 
   20    35        ECHO                                                     'The+%27Good+luck+and+thanks+for+all+the+cows%27+'
   21    36        BEGIN_SILENCE                                    ~18     
         37        INIT_FCALL                                               'var_dump'
         38        ASSIGN                                           ~19     !0, <array>
         39        FETCH_R                      local               ~20     ~19
         40        FETCH_DIM_R                                      ~21     ~20, 'cow'
         41        BW_AND                                           ~22     ~21, 2
         42        SEND_VAL                                                 ~22
         43        DO_ICALL                                                 
         44        END_SILENCE                                              ~18
   23    45        ECHO                                                     'The+%27Hurrah+BC+breaks%2C+if+your+program+broke+because+of+this+you%27re+a+bad+person%27+'
   24    46        ASSIGN                                           ~24     !3, <array>
         47        FETCH_LIST_R                                     $25     ~24, 0
         48        ASSIGN_DIM                                               !3
         49        OP_DATA                                                  $25
         50        FETCH_LIST_R                                     $27     ~24, 1
         51        ASSIGN_DIM                                               !3
         52        OP_DATA                                                  $27
         53        FREE                                                     ~24
   25    54        INIT_FCALL                                               'var_dump'
         55        SEND_VAR                                                 !3
         56        DO_ICALL                                                 
         57      > RETURN                                                   1

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

End of function bar

Class q:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xp12H
function name:  foo
number of ops:  4
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        CONCAT                                           ~1      'moo+', !0
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function foo

End of class q.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.67 ms | 1394 KiB | 16 Q