3v4l.org

run code in 300+ PHP versions simultaneously
<?php function newRememberMeCookie($id) { // generate 64 char random string and store it in current user data $random_token_string = hash('sha256', mt_rand()); $sql = "INSERT INTO lib_usercookies(user_id, user_cookies) VALUES (:user_id, :user_cookies)"; $stmt = $this->_db_connection->prepare($sql); $stmt->bindValue(':user_id', $id, PDO::PARAM_INT); $stmt->bindValue(':user_cookies', $random_token_string, PDO::PARAM_STR); $stmt->execute(); // generate cookie string that consists of userid, randomstring and combined hash of both $cookie_string_first_part = $random_token_string; $cookie_string_hash = hash_hmac('sha1', $cookie_string_first_part, "1gp@TMPS{+$78sfpMJFe-92s"); $cookie_string = $cookie_string_first_part . ':' . $cookie_string_hash; // set cookie setcookie('cri1432', $cookie_string, (time() + 60 * 60 * 24), '/', ".127.0.0.1"); } var_dump(newRememberMeCookie(1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a2l1h
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'newremembermecookie'
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function newremembermecookie:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a2l1h
function name:  newRememberMeCookie
number of ops:  48
compiled vars:  !0 = $id, !1 = $random_token_string, !2 = $sql, !3 = $stmt, !4 = $cookie_string_first_part, !5 = $cookie_string_hash, !6 = $cookie_string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'hash'
          2        SEND_VAL                                                 'sha256'
          3        INIT_FCALL                                               'mt_rand'
          4        DO_ICALL                                         $7      
          5        SEND_VAR                                                 $7
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !1, $8
    8     8        ASSIGN                                                   !2, 'INSERT+INTO+lib_usercookies%28user_id%2C+user_cookies%29+VALUES+%28%3Auser_id%2C+%3Auser_cookies%29'
    9     9        FETCH_THIS                                       $11     
         10        FETCH_OBJ_R                                      ~12     $11, '_db_connection'
         11        INIT_METHOD_CALL                                         ~12, 'prepare'
         12        SEND_VAR_EX                                              !2
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                                   !3, $13
   10    15        INIT_METHOD_CALL                                         !3, 'bindValue'
         16        SEND_VAL_EX                                              '%3Auser_id'
         17        SEND_VAR_EX                                              !0
         18        SEND_VAL_EX                                              1
         19        DO_FCALL                                      0          
   11    20        INIT_METHOD_CALL                                         !3, 'bindValue'
         21        SEND_VAL_EX                                              '%3Auser_cookies'
         22        SEND_VAR_EX                                              !1
         23        SEND_VAL_EX                                              2
         24        DO_FCALL                                      0          
   12    25        INIT_METHOD_CALL                                         !3, 'execute'
         26        DO_FCALL                                      0          
   14    27        ASSIGN                                                   !4, !1
   15    28        INIT_FCALL                                               'hash_hmac'
         29        SEND_VAL                                                 'sha1'
         30        SEND_VAR                                                 !4
         31        SEND_VAL                                                 '1gp%40TMPS%7B%2B%2478sfpMJFe-92s'
         32        DO_ICALL                                         $19     
         33        ASSIGN                                                   !5, $19
   16    34        CONCAT                                           ~21     !4, '%3A'
         35        CONCAT                                           ~22     ~21, !5
         36        ASSIGN                                                   !6, ~22
   18    37        INIT_FCALL                                               'setcookie'
         38        SEND_VAL                                                 'cri1432'
         39        SEND_VAR                                                 !6
         40        INIT_FCALL                                               'time'
         41        DO_ICALL                                         $24     
         42        ADD                                              ~25     $24, 86400
         43        SEND_VAL                                                 ~25
         44        SEND_VAL                                                 '%2F'
         45        SEND_VAL                                                 '.127.0.0.1'
         46        DO_ICALL                                                 
   19    47      > RETURN                                                   null

End of function newremembermecookie

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.52 ms | 1445 KiB | 20 Q