3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); $input = '243+6743-78*2='; $inputLenght = mb_strlen($input); $number = 0; $result = 0; $op = ''; for ($i = 0; $i < $inputLenght; $i++){ $char = mb_substr($input, $i, 1); if ($char == '+' || $char == '-' || $char == '*' || $char == '='){ if ($op == ''){ reporting($op, $result, $number, $char); $result = $number; }else if ($op == '+'){ reporting($op, $result, $number, $char); $result = $result + $number; }else if ($op == '-'){ reporting($op, $result, $number, $char); $result = $result - $number; }else if ($op == '*'){ reporting($op, $result, $number, $char); $result = $result * $number; } $op = $char; $number = 0; } elseif (is_numeric($char)){ $number = $number * 10 + $char; } else { echo "Неверный символ: {$char}\n"; } } echo "Ответ: {$input}{$result}\n"; function reporting($op, $result, $number, $char){ echo "op = [{$op}], result = [{$result}], number = [{$number}], char = [{$char}]\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
2 jumps found. (Code = 44) Position 1 = 90, Position 2 = 13
Branch analysis from position: 90
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 47) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 47) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 75
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 40
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
2 jumps found. (Code = 44) Position 1 = 90, Position 2 = 13
Branch analysis from position: 90
Branch analysis from position: 13
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 51
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 62
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 72
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
Branch analysis from position: 72
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 83
Branch analysis from position: 79
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
Branch analysis from position: 83
2 jumps found. (Code = 44) Position 1 = 90, Position 2 = 13
Branch analysis from position: 90
Branch analysis from position: 13
Branch analysis from position: 29
Branch analysis from position: 26
Branch analysis from position: 23
filename:       /in/1ensi
function name:  (null)
number of ops:  96
compiled vars:  !0 = $input, !1 = $inputLenght, !2 = $number, !3 = $result, !4 = $op, !5 = $i, !6 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    4     3        ASSIGN                                                   !0, '243%2B6743-78%2A2%3D'
    5     4        INIT_FCALL                                               'mb_strlen'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !1, $9
    7     8        ASSIGN                                                   !2, 0
    8     9        ASSIGN                                                   !3, 0
    9    10        ASSIGN                                                   !4, ''
   11    11        ASSIGN                                                   !5, 0
         12      > JMP                                                      ->88
   12    13    >   INIT_FCALL                                               'mb_substr'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !5
         16        SEND_VAL                                                 1
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !6, $15
   13    19        IS_EQUAL                                         ~17     !6, '%2B'
         20      > JMPNZ_EX                                         ~17     ~17, ->23
         21    >   IS_EQUAL                                         ~18     !6, '-'
         22        BOOL                                             ~17     ~18
         23    > > JMPNZ_EX                                         ~17     ~17, ->26
         24    >   IS_EQUAL                                         ~19     !6, '%2A'
         25        BOOL                                             ~17     ~19
         26    > > JMPNZ_EX                                         ~17     ~17, ->29
         27    >   IS_EQUAL                                         ~20     !6, '%3D'
         28        BOOL                                             ~17     ~20
         29    > > JMPZ                                                     ~17, ->75
   14    30    >   IS_EQUAL                                                 !4, ''
         31      > JMPZ                                                     ~21, ->40
   15    32    >   INIT_FCALL_BY_NAME                                       'reporting'
         33        SEND_VAR_EX                                              !4
         34        SEND_VAR_EX                                              !3
         35        SEND_VAR_EX                                              !2
         36        SEND_VAR_EX                                              !6
         37        DO_FCALL                                      0          
   16    38        ASSIGN                                                   !3, !2
         39      > JMP                                                      ->72
   17    40    >   IS_EQUAL                                                 !4, '%2B'
         41      > JMPZ                                                     ~24, ->51
   18    42    >   INIT_FCALL_BY_NAME                                       'reporting'
         43        SEND_VAR_EX                                              !4
         44        SEND_VAR_EX                                              !3
         45        SEND_VAR_EX                                              !2
         46        SEND_VAR_EX                                              !6
         47        DO_FCALL                                      0          
   19    48        ADD                                              ~26     !3, !2
         49        ASSIGN                                                   !3, ~26
         50      > JMP                                                      ->72
   20    51    >   IS_EQUAL                                                 !4, '-'
         52      > JMPZ                                                     ~28, ->62
   21    53    >   INIT_FCALL_BY_NAME                                       'reporting'
         54        SEND_VAR_EX                                              !4
         55        SEND_VAR_EX                                              !3
         56        SEND_VAR_EX                                              !2
         57        SEND_VAR_EX                                              !6
         58        DO_FCALL                                      0          
   22    59        SUB                                              ~30     !3, !2
         60        ASSIGN                                                   !3, ~30
         61      > JMP                                                      ->72
   23    62    >   IS_EQUAL                                                 !4, '%2A'
         63      > JMPZ                                                     ~32, ->72
   24    64    >   INIT_FCALL_BY_NAME                                       'reporting'
         65        SEND_VAR_EX                                              !4
         66        SEND_VAR_EX                                              !3
         67        SEND_VAR_EX                                              !2
         68        SEND_VAR_EX                                              !6
         69        DO_FCALL                                      0          
   25    70        MUL                                              ~34     !3, !2
         71        ASSIGN                                                   !3, ~34
   27    72    >   ASSIGN                                                   !4, !6
   28    73        ASSIGN                                                   !2, 0
         74      > JMP                                                      ->87
   29    75    >   INIT_FCALL                                               'is_numeric'
         76        SEND_VAR                                                 !6
         77        DO_ICALL                                         $38     
         78      > JMPZ                                                     $38, ->83
   30    79    >   MUL                                              ~39     !2, 10
         80        ADD                                              ~40     ~39, !6
         81        ASSIGN                                                   !2, ~40
         82      > JMP                                                      ->87
   32    83    >   ROPE_INIT                                     3  ~43     '%D0%9D%D0%B5%D0%B2%D0%B5%D1%80%D0%BD%D1%8B%D0%B9+%D1%81%D0%B8%D0%BC%D0%B2%D0%BE%D0%BB%3A+'
         84        ROPE_ADD                                      1  ~43     ~43, !6
         85        ROPE_END                                      2  ~42     ~43, '%0A'
         86        ECHO                                                     ~42
   11    87    >   PRE_INC                                                  !5
         88    >   IS_SMALLER                                               !5, !1
         89      > JMPNZ                                                    ~46, ->13
   36    90    >   ROPE_INIT                                     4  ~48     '%D0%9E%D1%82%D0%B2%D0%B5%D1%82%3A+'
         91        ROPE_ADD                                      1  ~48     ~48, !0
         92        ROPE_ADD                                      2  ~48     ~48, !3
         93        ROPE_END                                      3  ~47     ~48, '%0A'
         94        ECHO                                                     ~47
   40    95      > RETURN                                                   1

Function reporting:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1ensi
function name:  reporting
number of ops:  15
compiled vars:  !0 = $op, !1 = $result, !2 = $number, !3 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   39     4        ROPE_INIT                                     9  ~5      'op+%3D+%5B'
          5        ROPE_ADD                                      1  ~5      ~5, !0
          6        ROPE_ADD                                      2  ~5      ~5, '%5D%2C+result+%3D+%5B'
          7        ROPE_ADD                                      3  ~5      ~5, !1
          8        ROPE_ADD                                      4  ~5      ~5, '%5D%2C+number+%3D+%5B'
          9        ROPE_ADD                                      5  ~5      ~5, !2
         10        ROPE_ADD                                      6  ~5      ~5, '%5D%2C+char+%3D+%5B'
         11        ROPE_ADD                                      7  ~5      ~5, !3
         12        ROPE_END                                      8  ~4      ~5, '%5D%0A'
         13        ECHO                                                     ~4
   40    14      > RETURN                                                   null

End of function reporting

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.63 ms | 1408 KiB | 21 Q