3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); mb_internal_encoding('utf-8'); $input = '78.95+874.1*3/11.3-88='; $inputLength = mb_strlen($input); $result = 0; //результат предыдущего действия $numbersAndOperations = array(); $numbersAndOperations = preg_split('/(?=[-+*=\\/])|(?<=[-+*=\\/])/', $input); $result = $numbersAndOperations[0]; for ($i = 1; $i < count($numbersAndOperations); $i+=2) { if ($numbersAndOperations[$i] == '+'){ $result += intval($numbersAndOperations[$i+1]); }elseif($numbersAndOperations[$i] == '-'){ $result -= intval($numbersAndOperations[$i+1]); }elseif($numbersAndOperations[$i] == '*'){ $result *= intval($numbersAndOperations[$i+1]); }elseif($numbersAndOperations[$i] == '/') { $result /= intval($numbersAndOperations[$i+1]); }else { echo "Ответ: $input$result"; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 22
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 22
Branch analysis from position: 62
Branch analysis from position: 22
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 38
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 46
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 54
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 22
Branch analysis from position: 62
Branch analysis from position: 22
filename:       /in/3O7ng
function name:  (null)
number of ops:  63
compiled vars:  !0 = $input, !1 = $inputLength, !2 = $result, !3 = $numbersAndOperations, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'mb_internal_encoding'
          4        SEND_VAL                                                 'utf-8'
          5        DO_ICALL                                                 
    6     6        ASSIGN                                                   !0, '78.95%2B874.1%2A3%2F11.3-88%3D'
    7     7        INIT_FCALL                                               'mb_strlen'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !1, $8
    9    11        ASSIGN                                                   !2, 0
   11    12        ASSIGN                                                   !3, <array>
   12    13        INIT_FCALL                                               'preg_split'
         14        SEND_VAL                                                 '%2F%28%3F%3D%5B-%2B%2A%3D%5C%2F%5D%29%7C%28%3F%3C%3D%5B-%2B%2A%3D%5C%2F%5D%29%2F'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $12     
         17        ASSIGN                                                   !3, $12
   14    18        FETCH_DIM_R                                      ~14     !3, 0
         19        ASSIGN                                                   !2, ~14
   16    20        ASSIGN                                                   !4, 1
         21      > JMP                                                      ->59
   17    22    >   FETCH_DIM_R                                      ~17     !3, !4
         23        IS_EQUAL                                                 ~17, '%2B'
         24      > JMPZ                                                     ~18, ->30
   18    25    >   ADD                                              ~19     !4, 1
         26        FETCH_DIM_R                                      ~20     !3, ~19
         27        CAST                                          4  ~21     ~20
         28        ASSIGN_OP                                     1          !2, ~21
         29      > JMP                                                      ->58
   19    30    >   FETCH_DIM_R                                      ~23     !3, !4
         31        IS_EQUAL                                                 ~23, '-'
         32      > JMPZ                                                     ~24, ->38
   20    33    >   ADD                                              ~25     !4, 1
         34        FETCH_DIM_R                                      ~26     !3, ~25
         35        CAST                                          4  ~27     ~26
         36        ASSIGN_OP                                     2          !2, ~27
         37      > JMP                                                      ->58
   21    38    >   FETCH_DIM_R                                      ~29     !3, !4
         39        IS_EQUAL                                                 ~29, '%2A'
         40      > JMPZ                                                     ~30, ->46
   22    41    >   ADD                                              ~31     !4, 1
         42        FETCH_DIM_R                                      ~32     !3, ~31
         43        CAST                                          4  ~33     ~32
         44        ASSIGN_OP                                     3          !2, ~33
         45      > JMP                                                      ->58
   23    46    >   FETCH_DIM_R                                      ~35     !3, !4
         47        IS_EQUAL                                                 ~35, '%2F'
         48      > JMPZ                                                     ~36, ->54
   24    49    >   ADD                                              ~37     !4, 1
         50        FETCH_DIM_R                                      ~38     !3, ~37
         51        CAST                                          4  ~39     ~38
         52        ASSIGN_OP                                     4          !2, ~39
         53      > JMP                                                      ->58
   26    54    >   ROPE_INIT                                     3  ~42     '%D0%9E%D1%82%D0%B2%D0%B5%D1%82%3A+'
         55        ROPE_ADD                                      1  ~42     ~42, !0
         56        ROPE_END                                      2  ~41     ~42, !2
         57        ECHO                                                     ~41
   16    58    >   ASSIGN_OP                                     1          !4, 2
         59    >   COUNT                                            ~45     !3
         60        IS_SMALLER                                               !4, ~45
         61      > JMPNZ                                                    ~46, ->22
   28    62    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149 ms | 1400 KiB | 21 Q