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 = 10, Position 2 = 34
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 34
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 33
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 33
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/mfObi
function name:  (null)
number of ops:  44
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        ROPE_INIT                                     3  ~9      '%3C%3Fphp+'
          3        ROPE_ADD                                      1  ~9      ~9, !0
          4        ROPE_END                                      2  ~8      ~9, '+%3F%3E'
          5        SEND_VAL                                                 ~8
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !1, $11
    7     8        ASSIGN                                                   !2, ''
    9     9      > FE_RESET_R                                       $14     !1, ->34
         10    > > FE_FETCH_R                                               $14, !3, ->34
   10    11    >   TYPE_CHECK                                   64          !3
         12      > JMPZ                                                     ~15, ->19
   12    13    >   IN_ARRAY                                                 !3, <array>
         14      > JMPZ                                                     ~16, ->18
   13    15    >   ASSIGN_OP                                     8          !2, !3
   14    16        CONCAT                                           ~18     '%0A+symbol%3A+', !2
         17        ECHO                                                     ~18
   16    18    > > JMP                                                      ->10
   19    19    >   QM_ASSIGN                                        ~19     !3
         20        FETCH_LIST_R                                     $20     ~19, 0
         21        ASSIGN                                                   !4, $20
         22        FETCH_LIST_R                                     $22     ~19, 1
         23        ASSIGN                                                   !5, $22
         24        FREE                                                     ~19
   21    25        INIT_FCALL                                               'in_array'
         26        SEND_VAR                                                 !4
         27        SEND_VAL                                                 <array>
         28        DO_ICALL                                         $24     
         29      > JMPZ                                                     $24, ->33
   22    30    >   ASSIGN_OP                                     8          !2, !5
   23    31        CONCAT                                           ~26     '%0A+number%3A+', !2
         32        ECHO                                                     ~26
    9    33    > > JMP                                                      ->10
         34    >   FE_FREE                                                  $14
   27    35        ROPE_INIT                                     3  ~28     '%24result+%3D+'
         36        ROPE_ADD                                      1  ~28     ~28, !2
         37        ROPE_END                                      2  ~27     ~28, '%3B'
         38        INCLUDE_OR_EVAL                                          ~27, EVAL
   29    39        CONCAT                                           ~31     '%0Aexpr+%3D+', !2
         40        ECHO                                                     ~31
   30    41        CONCAT                                           ~32     '%0Ares+%3D+', !6
         42        ECHO                                                     ~32
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.28 ms | 1400 KiB | 17 Q