3v4l.org

run code in 300+ 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; } $result = eval("return ({$expr});"); print "\n" . $expr; print "\n" . $result;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 29
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 29
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 = 27, Position 2 = 28
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 28
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/B2BNi
function name:  (null)
number of ops:  40
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, '%28800+%2B+20%29+-+800+%2F+2'
    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, ->29
          9    > > FE_FETCH_R                                               $12, !3, ->29
   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        INIT_FCALL                                               'in_array'
         23        SEND_VAR                                                 !4
         24        SEND_VAL                                                 <array>
         25        DO_ICALL                                         $21     
         26      > JMPZ                                                     $21, ->28
   21    27    >   ASSIGN_OP                                     8          !2, !5
    8    28    > > JMP                                                      ->9
         29    >   FE_FREE                                                  $12
   26    30        ROPE_INIT                                     3  ~24     'return+%28'
         31        ROPE_ADD                                      1  ~24     ~24, !2
         32        ROPE_END                                      2  ~23     ~24, '%29%3B'
         33        INCLUDE_OR_EVAL                                  $26     ~23, EVAL
         34        ASSIGN                                                   !6, $26
   28    35        CONCAT                                           ~28     '%0A', !2
         36        ECHO                                                     ~28
   29    37        CONCAT                                           ~29     '%0A', !6
         38        ECHO                                                     ~29
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.96 ms | 1392 KiB | 17 Q