3v4l.org

run code in 300+ PHP versions simultaneously
<?php $msg=(string)($_GET['message']?? $_POST['message'] ?? "no message!"); $answer=NULL; var_dump(getcwd()); register_shutdown_function(function()use(&$answer){ var_dump(getcwd()); file_put_contents(__DIR__.DIRECTORY_SEPARATOR.'msg.log.txt',json_encode(['answer'=>$answer,'$_GET'=>$_GET],JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_LINE_TERMINATORS ),FILE_APPEND|LOCK_EX); }); $matches=NULL; $isMatch=preg_match("/(\d+)\s*(\+|\-|\*|\/|\:)\s*(\d+)/",$msg,$matches); if($isMatch){ $l=(int)$matches[1]; $o=$matches[2]; $r=(int)$matches[3]; switch($o){ case '+': $res=$l+$r; break; case '-': $res=$l-$r; break; case '*': $res=$l*$r; break; case '/': case ':': $res=$l/$r; break; default: throw new \LogicException("invalid operator passed regex??!"); } $answer="!check {$res}"; echo $answer; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 69
Branch analysis from position: 29
7 jumps found. (Code = 188) Position 1 = 49, Position 2 = 52, Position 3 = 55, Position 4 = 58, Position 5 = 58, Position 6 = 61, Position 7 = 38
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 58
Branch analysis from position: 61
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 49
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 52
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 55
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 58
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 58
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
Branch analysis from position: 58
Branch analysis from position: 58
Branch analysis from position: 55
Branch analysis from position: 52
Branch analysis from position: 49
Branch analysis from position: 69
filename:       /in/fuRZs
function name:  (null)
number of ops:  70
compiled vars:  !0 = $msg, !1 = $answer, !2 = $matches, !3 = $isMatch, !4 = $l, !5 = $o, !6 = $r, !7 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   FETCH_IS                                         ~8      '_GET'
          1        FETCH_DIM_IS                                     ~9      ~8, 'message'
          2        COALESCE                                         ~10     ~9
          3        FETCH_IS                                         ~11     '_POST'
          4        FETCH_DIM_IS                                     ~12     ~11, 'message'
          5        COALESCE                                         ~13     ~12
          6        QM_ASSIGN                                        ~13     'no+message%21'
          7        QM_ASSIGN                                        ~10     ~13
          8        CAST                                          6  ~14     ~10
          9        ASSIGN                                                   !0, ~14
    3    10        ASSIGN                                                   !1, null
    4    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'getcwd'
         13        DO_ICALL                                         $17     
         14        SEND_VAR                                                 $17
         15        DO_ICALL                                                 
    5    16        INIT_FCALL                                               'register_shutdown_function'
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfuRZs%3A5%240'
         18        BIND_LEXICAL                                             ~19, !1
    8    19        SEND_VAL                                                 ~19
         20        DO_ICALL                                                 
   10    21        ASSIGN                                                   !2, null
   11    22        INIT_FCALL                                               'preg_match'
         23        SEND_VAL                                                 '%2F%28%5Cd%2B%29%5Cs%2A%28%5C%2B%7C%5C-%7C%5C%2A%7C%5C%2F%7C%5C%3A%29%5Cs%2A%28%5Cd%2B%29%2F'
         24        SEND_VAR                                                 !0
         25        SEND_REF                                                 !2
         26        DO_ICALL                                         $22     
         27        ASSIGN                                                   !3, $22
   12    28      > JMPZ                                                     !3, ->69
   13    29    >   FETCH_DIM_R                                      ~24     !2, 1
         30        CAST                                          4  ~25     ~24
         31        ASSIGN                                                   !4, ~25
   14    32        FETCH_DIM_R                                      ~27     !2, 2
         33        ASSIGN                                                   !5, ~27
   15    34        FETCH_DIM_R                                      ~29     !2, 3
         35        CAST                                          4  ~30     ~29
         36        ASSIGN                                                   !6, ~30
   16    37      > SWITCH_STRING                                            !5, [ '%2B':->49, '-':->52, '%2A':->55, '%2F':->58, '%3A':->58, ], ->61
   17    38    >   IS_EQUAL                                                 !5, '%2B'
         39      > JMPNZ                                                    ~32, ->49
   20    40    >   IS_EQUAL                                                 !5, '-'
         41      > JMPNZ                                                    ~32, ->52
   23    42    >   IS_EQUAL                                                 !5, '%2A'
         43      > JMPNZ                                                    ~32, ->55
   26    44    >   IS_EQUAL                                                 !5, '%2F'
         45      > JMPNZ                                                    ~32, ->58
   27    46    >   IS_EQUAL                                                 !5, '%3A'
         47      > JMPNZ                                                    ~32, ->58
         48    > > JMP                                                      ->61
   18    49    >   ADD                                              ~33     !4, !6
         50        ASSIGN                                                   !7, ~33
   19    51      > JMP                                                      ->65
   21    52    >   SUB                                              ~35     !4, !6
         53        ASSIGN                                                   !7, ~35
   22    54      > JMP                                                      ->65
   24    55    >   MUL                                              ~37     !4, !6
         56        ASSIGN                                                   !7, ~37
   25    57      > JMP                                                      ->65
   28    58    >   DIV                                              ~39     !4, !6
         59        ASSIGN                                                   !7, ~39
   29    60      > JMP                                                      ->65
   31    61    >   NEW                                              $41     'LogicException'
         62        SEND_VAL_EX                                              'invalid+operator+passed+regex%3F%3F%21'
         63        DO_FCALL                                      0          
         64      > THROW                                         0          $41
   33    65    >   NOP                                                      
         66        FAST_CONCAT                                      ~43     '%21check+', !7
         67        ASSIGN                                                   !1, ~43
   34    68        ECHO                                                     !1
   35    69    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfuRZs%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fuRZs
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $answer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
    6     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'getcwd'
          3        DO_ICALL                                         $1      
          4        SEND_VAR                                                 $1
          5        DO_ICALL                                                 
    7     6        INIT_FCALL                                               'file_put_contents'
          7        SEND_VAL                                                 '%2Fin%2Fmsg.log.txt'
          8        INIT_FCALL                                               'json_encode'
          9        INIT_ARRAY                                       ~3      !0, 'answer'
         10        FETCH_R                      global              ~4      '_GET'
         11        ADD_ARRAY_ELEMENT                                ~3      ~4, '%24_GET'
         12        SEND_VAL                                                 ~3
         13        SEND_VAL                                                 2496
         14        DO_ICALL                                         $5      
         15        SEND_VAR                                                 $5
         16        SEND_VAL                                                 10
         17        DO_ICALL                                                 
    8    18      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfuRZs%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
266.03 ms | 1404 KiB | 26 Q