3v4l.org

run code in 500+ PHP versions simultaneously
<?php $input = '((800 + 20) - 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; 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 = 26
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 26
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 15
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/vbLdo
function name:  (null)
number of ops:  36
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%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, ->26
          9    > > FE_FETCH_R                                                   $12, !3, ->26
   10    10    >   TYPE_CHECK                                       64          !3
         11      > JMPZ                                                         ~13, ->16
   12    12    >   IN_ARRAY                                                     !3, <array>
         13      > JMPZ                                                         ~14, ->15
   13    14    >   ASSIGN_OP                                         8          !2, !3
   15    15    > > JMP                                                          ->9
   18    16    >   QM_ASSIGN                                            ~16     !3
         17        FETCH_LIST_R                                         $17     ~16, 0
         18        ASSIGN                                                       !4, $17
         19        FETCH_LIST_R                                         $19     ~16, 1
         20        ASSIGN                                                       !5, $19
         21        FREE                                                         ~16
   20    22        FRAMELESS_ICALL_2                in_array            ~21     !4, <array>
         23      > JMPZ                                                         ~21, ->25
   21    24    >   ASSIGN_OP                                         8          !2, !5
    8    25    > > JMP                                                          ->9
         26    >   FE_FREE                                                      $12
   24    27        ROPE_INIT                                         3  ~24     '%24result+%3D+'
         28        ROPE_ADD                                          1  ~24     ~24, !2
         29        ROPE_END                                          2  ~23     ~24, '%3B'
         30        INCLUDE_OR_EVAL                                              ~23, EVAL
   26    31        CONCAT                                               ~27     '%0Aexpr+%3D+', !2
         32        ECHO                                                         ~27
   27    33        CONCAT                                               ~28     '%0Ares+%3D+', !6
         34        ECHO                                                         ~28
         35      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
184.81 ms | 2962 KiB | 14 Q