3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data="musisz odpowiedziec w ciagu 280 sekund: 88+67=?musisz odpowiedziec w ciagu 280 sekund: 88+67=?musisz odpowiedziec w ciagu 280 sekund: 88+67=?"; $rret = preg_match('/((\d+)(\+|\-|\*)(\d+))\s*\=\s*\?/', $data, $matches); if ($rret !== 1) { throw new \LogicException("ERROR: COULD NOT EXTRACT MATH QUESTION!"); } $left = (int)$matches[2]; $operator = $matches[3]; $right = (int)$matches[4]; $answer = null; switch ($operator) { case "+": { $answer = $left + $right; break; } case "*": { $answer = $left * $right; break; } case "-": { $answer = $left - $right; break; } default: { throw new \LogicException("UNKNOWN OPERATOR: {$operator}"); } } echo "question parsed: answer: \"{$answer}\" left: \"{$left}\" operator: \"{$operator}\" right: \"{$right}\"\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
5 jumps found. (Code = 188) Position 1 = 30, Position 2 = 33, Position 3 = 36, Position 4 = 39, Position 5 = 23
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 39
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 33
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 36
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 36
Branch analysis from position: 33
Branch analysis from position: 30
filename:       /in/F5IKon
function name:  (null)
number of ops:  56
compiled vars:  !0 = $data, !1 = $rret, !2 = $matches, !3 = $left, !4 = $operator, !5 = $right, !6 = $answer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'musisz+odpowiedziec+w+ciagu+280+sekund%3A+88%2B67%3D%3Fmusisz+odpowiedziec+w+ciagu+280+sekund%3A+88%2B67%3D%3Fmusisz+odpowiedziec+w+ciagu+280+sekund%3A+88%2B67%3D%3F'
    3     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%28%28%5Cd%2B%29%28%5C%2B%7C%5C-%7C%5C%2A%29%28%5Cd%2B%29%29%5Cs%2A%5C%3D%5Cs%2A%5C%3F%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !2
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !1, $8
    4     7        IS_NOT_IDENTICAL                                         !1, 1
          8      > JMPZ                                                     ~10, ->13
    5     9    >   NEW                                              $11     'LogicException'
         10        SEND_VAL_EX                                              'ERROR%3A+COULD+NOT+EXTRACT+MATH+QUESTION%21'
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $11
    7    13    >   FETCH_DIM_R                                      ~13     !2, 2
         14        CAST                                          4  ~14     ~13
         15        ASSIGN                                                   !3, ~14
    8    16        FETCH_DIM_R                                      ~16     !2, 3
         17        ASSIGN                                                   !4, ~16
    9    18        FETCH_DIM_R                                      ~18     !2, 4
         19        CAST                                          4  ~19     ~18
         20        ASSIGN                                                   !5, ~19
   10    21        ASSIGN                                                   !6, null
   11    22      > SWITCH_STRING                                            !4, [ '%2B':->30, '%2A':->33, '-':->36, ], ->39
   12    23    >   IS_EQUAL                                                 !4, '%2B'
         24      > JMPNZ                                                    ~22, ->30
   17    25    >   IS_EQUAL                                                 !4, '%2A'
         26      > JMPNZ                                                    ~22, ->33
   22    27    >   IS_EQUAL                                                 !4, '-'
         28      > JMPNZ                                                    ~22, ->36
         29    > > JMP                                                      ->39
   14    30    >   ADD                                              ~23     !3, !5
         31        ASSIGN                                                   !6, ~23
   15    32      > JMP                                                      ->45
   19    33    >   MUL                                              ~25     !3, !5
         34        ASSIGN                                                   !6, ~25
   20    35      > JMP                                                      ->45
   24    36    >   SUB                                              ~27     !3, !5
         37        ASSIGN                                                   !6, ~27
   25    38      > JMP                                                      ->45
   29    39    >   NEW                                              $29     'LogicException'
         40        NOP                                                      
         41        FAST_CONCAT                                      ~30     'UNKNOWN+OPERATOR%3A+', !4
         42        SEND_VAL_EX                                              ~30
         43        DO_FCALL                                      0          
         44      > THROW                                         0          $29
   32    45    >   ROPE_INIT                                     9  ~33     'question+parsed%3A+answer%3A+%22'
         46        ROPE_ADD                                      1  ~33     ~33, !6
         47        ROPE_ADD                                      2  ~33     ~33, '%22+left%3A+%22'
         48        ROPE_ADD                                      3  ~33     ~33, !3
         49        ROPE_ADD                                      4  ~33     ~33, '%22+operator%3A+%22'
         50        ROPE_ADD                                      5  ~33     ~33, !4
         51        ROPE_ADD                                      6  ~33     ~33, '%22+right%3A+%22'
         52        ROPE_ADD                                      7  ~33     ~33, !5
         53        ROPE_END                                      8  ~32     ~33, '%22%0A'
         54        ECHO                                                     ~32
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.59 ms | 1400 KiB | 15 Q