3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.78 ms | 1400 KiB | 17 Q