3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '$x=100; ((800 + 20) - 800 / 2)'; $tokens = token_get_all("<?php {$input}"); $expr = ''; foreach($tokens as $token){ echo $token."<br>"; if(is_string($token)){ if(in_array($token, array('(', ')', '+', '-', '/', '*','if','IF' , '{' ,'}' , ';' ,'$'), true)) $expr .= $token; continue; } list($id, $text) = $token; if(in_array($id, array(T_DNUMBER, T_LNUMBER))) $expr .= $text; } 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 = 31
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 31
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
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 = 30
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 30
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/cs1pv
function name:  (null)
number of ops:  41
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, '%24x%3D100%3B+%28%28800+%2B+20%29+-+800+%2F+2%29'
    5     1        INIT_FCALL                                               'token_get_all'
          2        NOP                                                      
          3        FAST_CONCAT                                      ~8      '%3C%3Fphp+', !0
          4        SEND_VAL                                                 ~8
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !1, $9
    6     7        ASSIGN                                                   !2, ''
    8     8      > FE_RESET_R                                       $12     !1, ->31
          9    > > FE_FETCH_R                                               $12, !3, ->31
    9    10    >   CONCAT                                           ~13     !3, '%3Cbr%3E'
         11        ECHO                                                     ~13
   10    12        TYPE_CHECK                                   64          !3
         13      > JMPZ                                                     ~14, ->18
   12    14    >   IN_ARRAY                                                 !3, <array>
         15      > JMPZ                                                     ~15, ->17
   13    16    >   ASSIGN_OP                                     8          !2, !3
   15    17    > > JMP                                                      ->9
   18    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
   20    24        INIT_FCALL                                               'in_array'
         25        SEND_VAR                                                 !4
         26        SEND_VAL                                                 <array>
         27        DO_ICALL                                         $22     
         28      > JMPZ                                                     $22, ->30
   21    29    >   ASSIGN_OP                                     8          !2, !5
    8    30    > > JMP                                                      ->9
         31    >   FE_FREE                                                  $12
   24    32        ROPE_INIT                                     3  ~25     '%24result+%3D+'
         33        ROPE_ADD                                      1  ~25     ~25, !2
         34        ROPE_END                                      2  ~24     ~25, '%3B'
         35        INCLUDE_OR_EVAL                                          ~24, EVAL
   26    36        CONCAT                                           ~28     '%0Aexpr+%3D+', !2
         37        ECHO                                                     ~28
   27    38        CONCAT                                           ~29     '%0Ares+%3D+', !6
         39        ECHO                                                     ~29
   28    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
204.37 ms | 1400 KiB | 17 Q