3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '((\'rats\' + \'stoats\') - 800 / 2)'; $tokens = token_get_all("<? php {$input}"); $expr = ''; foreach($tokens as $token){ if(is_string($token)){ if(in_array($token, array('(', ')', '+', '-', '/', '*'), true)){ $expr .= $token; print "\n symbol: " . $expr; } continue; } list($id, $text) = $token; if(in_array($id, array(T_DNUMBER, T_LNUMBER,T_CONSTANT_ENCAPSED_STRING))){ $expr .= $text; print "\n number: " . $expr; } } eval("\$result = {$expr};"); print "\nexpr = " . $expr; print "\nres = " . $result;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 33
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 33
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 32
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/fZKEH
function name:  (null)
number of ops:  43
compiled vars:  !0 = $input, !1 = $tokens, !2 = $expr, !3 = $token, !4 = $id, !5 = $text, !6 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%28%28%27rats%27+%2B+%27stoats%27%29+-+800+%2F+2%29'
    5     1        INIT_FCALL                                               'token_get_all'
          2        NOP                                                      
          3        FAST_CONCAT                                      ~8      '%3C%3F+php+', !0
          4        SEND_VAL                                                 ~8
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !1, $9
    7     7        ASSIGN                                                   !2, ''
    9     8      > FE_RESET_R                                       $12     !1, ->33
          9    > > FE_FETCH_R                                               $12, !3, ->33
   11    10    >   TYPE_CHECK                                   64          !3
         11      > JMPZ                                                     ~13, ->18
   13    12    >   IN_ARRAY                                                 !3, <array>
         13      > JMPZ                                                     ~14, ->17
   14    14    >   ASSIGN_OP                                     8          !2, !3
   15    15        CONCAT                                           ~16     '%0A+symbol%3A+', !2
         16        ECHO                                                     ~16
   17    17    > > JMP                                                      ->9
   20    18    >   QM_ASSIGN                                        ~17     !3
         19        FETCH_LIST_R                                     $18     ~17, 0
         20        ASSIGN                                                   !4, $18
         21        FETCH_LIST_R                                     $20     ~17, 1
         22        ASSIGN                                                   !5, $20
         23        FREE                                                     ~17
   22    24        INIT_FCALL                                               'in_array'
         25        SEND_VAR                                                 !4
         26        SEND_VAL                                                 <array>
         27        DO_ICALL                                         $22     
         28      > JMPZ                                                     $22, ->32
   23    29    >   ASSIGN_OP                                     8          !2, !5
   24    30        CONCAT                                           ~24     '%0A+number%3A+', !2
         31        ECHO                                                     ~24
    9    32    > > JMP                                                      ->9
         33    >   FE_FREE                                                  $12
   28    34        ROPE_INIT                                     3  ~26     '%24result+%3D+'
         35        ROPE_ADD                                      1  ~26     ~26, !2
         36        ROPE_END                                      2  ~25     ~26, '%3B'
         37        INCLUDE_OR_EVAL                                          ~25, EVAL
   30    38        CONCAT                                           ~29     '%0Aexpr+%3D+', !2
         39        ECHO                                                     ~29
   31    40        CONCAT                                           ~30     '%0Ares+%3D+', !6
         41        ECHO                                                     ~30
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.58 ms | 1400 KiB | 17 Q