3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '((800 + {$test->value}) - 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; print "\ntoken=".$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 = 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 = 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/B6v45
function name:  (null)
number of ops:  35
compiled vars:  !0 = $input, !1 = $tokens, !2 = $expr, !3 = $token, !4 = $id, !5 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%28%28800+%2B+%7B%24test-%3Evalue%7D%29+-+800+%2F+2%29'
    5     1        INIT_FCALL                                               'token_get_all'
          2        NOP                                                      
          3        FAST_CONCAT                                      ~7      '%3C%3Fphp+', !0
          4        SEND_VAL                                                 ~7
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !1, $8
    6     7        ASSIGN                                                   !2, ''
    8     8      > FE_RESET_R                                       $11     !1, ->31
          9    > > FE_FETCH_R                                               $11, !3, ->31
   10    10    >   TYPE_CHECK                                   64          !3
         11      > JMPZ                                                     ~12, ->16
   12    12    >   IN_ARRAY                                                 !3, <array>
         13      > JMPZ                                                     ~13, ->15
   13    14    >   ASSIGN_OP                                     8          !2, !3
   15    15    > > JMP                                                      ->9
   18    16    >   QM_ASSIGN                                        ~15     !3
         17        FETCH_LIST_R                                     $16     ~15, 0
         18        ASSIGN                                                   !4, $16
         19        FETCH_LIST_R                                     $18     ~15, 1
         20        ASSIGN                                                   !5, $18
         21        FREE                                                     ~15
   19    22        CONCAT                                           ~20     '%0Atoken%3D', !3
         23        ECHO                                                     ~20
   21    24        INIT_FCALL                                               'in_array'
         25        SEND_VAR                                                 !4
         26        SEND_VAL                                                 <array>
         27        DO_ICALL                                         $21     
         28      > JMPZ                                                     $21, ->30
   22    29    >   ASSIGN_OP                                     8          !2, !5
    8    30    > > JMP                                                      ->9
         31    >   FE_FREE                                                  $11
   27    32        CONCAT                                           ~23     '%0Aexpr+%3D+', !2
         33        ECHO                                                     ~23
   28    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.15 ms | 1400 KiB | 17 Q