3v4l.org

run code in 300+ PHP versions simultaneously
<?php $formSubmitted = false; if( isset( $_SERVER["REQUEST_METHOD"] ) && "POST" == $_SERVER["REQUEST_METHOD"] ) { $postData = $_POST; $user = isset( $postData["user"] ) ? $postData["user"] : ""; $color = isset( $postData["color"] ) ? $postData["color"] : ""; if( !empty( $user ) && !empty( $color ) ) { setcookie( "cookie_name", $user, time() + 86400 ); setcookie( "cookie_color", $user, time() + 86400 ); $formSubmitted = true; } } ?> <html> <body> <form method='POST'> <h1>Cookie Monster Jar</h1> Please Enter Your First name: <input type="text" name="user"><br> <input type='radio' name='color' value='red'>red <input type='radio' name='color' value='green'>green <input type='radio' name='color' value='blue'>blue<br> <input type='submit' value='Submit'/> </form> <?php if( $formSubmitted ) : ?> <div> Your name is <?php echo $user; ?>,and your favorite color is <?php echo $color; ?>. Cookies has been saved. </div> <?php else : ?> <div> Cookies aren't saved yet. </div> <?php endif; ?> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 49
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 49
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 57
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
Branch analysis from position: 31
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
Branch analysis from position: 31
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
Branch analysis from position: 23
Branch analysis from position: 49
Branch analysis from position: 8
filename:       /in/Z27fs
function name:  (null)
number of ops:  60
compiled vars:  !0 = $formSubmitted, !1 = $postData, !2 = $user, !3 = $color
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <false>
    4     1        FETCH_IS                                         ~5      '_SERVER'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      ~5, 'REQUEST_METHOD'
          3      > JMPZ_EX                                          ~6      ~6, ->8
          4    >   FETCH_R                      global              ~7      '_SERVER'
          5        FETCH_DIM_R                                      ~8      ~7, 'REQUEST_METHOD'
          6        IS_EQUAL                                         ~9      ~8, 'POST'
          7        BOOL                                             ~6      ~9
          8    > > JMPZ                                                     ~6, ->49
    5     9    >   FETCH_R                      global              ~10     '_POST'
         10        ASSIGN                                                   !1, ~10
    6    11        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'user'
         12      > JMPZ                                                     ~12, ->16
         13    >   FETCH_DIM_R                                      ~13     !1, 'user'
         14        QM_ASSIGN                                        ~14     ~13
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~14     ''
         17    >   ASSIGN                                                   !2, ~14
    7    18        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'color'
         19      > JMPZ                                                     ~16, ->23
         20    >   FETCH_DIM_R                                      ~17     !1, 'color'
         21        QM_ASSIGN                                        ~18     ~17
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~18     ''
         24    >   ASSIGN                                                   !3, ~18
    9    25        ISSET_ISEMPTY_CV                                 ~20     !2
         26        BOOL_NOT                                         ~21     ~20
         27      > JMPZ_EX                                          ~21     ~21, ->31
         28    >   ISSET_ISEMPTY_CV                                 ~22     !3
         29        BOOL_NOT                                         ~23     ~22
         30        BOOL                                             ~21     ~23
         31    > > JMPZ                                                     ~21, ->49
   10    32    >   INIT_FCALL                                               'setcookie'
         33        SEND_VAL                                                 'cookie_name'
         34        SEND_VAR                                                 !2
         35        INIT_FCALL                                               'time'
         36        DO_ICALL                                         $24     
         37        ADD                                              ~25     $24, 86400
         38        SEND_VAL                                                 ~25
         39        DO_ICALL                                                 
   11    40        INIT_FCALL                                               'setcookie'
         41        SEND_VAL                                                 'cookie_color'
         42        SEND_VAR                                                 !2
         43        INIT_FCALL                                               'time'
         44        DO_ICALL                                         $27     
         45        ADD                                              ~28     $27, 86400
         46        SEND_VAL                                                 ~28
         47        DO_ICALL                                                 
   12    48        ASSIGN                                                   !0, <true>
   17    49    >   ECHO                                                     '%3Chtml%3E%0A%09%3Cbody%3E%0A%09%09%3Cform+method%3D%27POST%27%3E%0A%09%09%09%3Ch1%3ECookie+Monster+Jar%3C%2Fh1%3E%0A%09%09%09Please+Enter+Your+First+name%3A+%3Cinput+type%3D%22text%22+name%3D%22user%22%3E%3Cbr%3E%0A%09%09%09%3Cinput+type%3D%27radio%27+name%3D%27color%27+value%3D%27red%27%3Ered%0A%09%09%09%3Cinput+type%3D%27radio%27+name%3D%27color%27+value%3D%27green%27%3Egreen%0A%09%09%09%3Cinput+type%3D%27radio%27+name%3D%27color%27+value%3D%27blue%27%3Eblue%3Cbr%3E%0A%09%09%09%3Cinput+type%3D%27submit%27+value%3D%27Submit%27%2F%3E%0A%09%09%3C%2Fform%3E%0A%09%09'
   27    50      > JMPZ                                                     !0, ->57
   28    51    >   ECHO                                                     '%09%09%3Cdiv%3E%0A%09%09%09Your+name+is+'
   29    52        ECHO                                                     !2
         53        ECHO                                                     '%2Cand+your+favorite+color+is+'
         54        ECHO                                                     !3
         55        ECHO                                                     '.%0A%09%09%09Cookies+has+been+saved.%0A%09%09%3C%2Fdiv%3E%0A%09%09'
         56      > JMP                                                      ->58
   33    57    >   ECHO                                                     '%09%09%3Cdiv%3E%0A%09%09%09Cookies+aren%27t+saved+yet.%0A%09%09%3C%2Fdiv%3E%0A%09%09'
   37    58    >   ECHO                                                     '%09%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   38    59      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.88 ms | 1400 KiB | 17 Q