3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Db { public function fp($value) { var_dump($value); } } class Model{ public $_attributes = []; public $Db; public function __construct($data = null) { $this->_attributes = $data; $this->Db = new Db; print_r($this); } public function __get($name) { return $this->_attributes[$name]; } public function __set($name, $value) { $this->_attributes[$name] = $value; } public function AuthCheck(){ if(!empty($_COOKIE['user'])){ $models = $this->LoadUser($_COOKIE['user']); if(!empty($_COOKIE['user']) && !empty($_COOKIE['hash']) && $_COOKIE['hash'] == $models->access_token && $models->uid == $_COOKIE['user']){ return true; }else return false; }else return false; } public function LoadUser($uid){ print_r($this); return $this->Db->fp("SELECT * FROM users WHERE uid = ?", [$uid]); } function loadUsersAll(){ return $this->Db->fALL("SELECT * FROM users"); } } $_COOKIE['user'] = 1; $model = new Model(); $model->AuthCheck();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HtlAU
function name:  (null)
number of ops:  9
compiled vars:  !0 = $model
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   FETCH_W                      global              $1      '_COOKIE'
          1        ASSIGN_DIM                                               $1, 'user'
          2        OP_DATA                                                  1
   52     3        NEW                                              $3      'Model'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   53     6        INIT_METHOD_CALL                                         !0, 'AuthCheck'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class Db:
Function fp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HtlAU
function name:  fp
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    7     4      > RETURN                                                   null

End of function fp

End of class Db.

Class Model:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HtlAU
function name:  __construct
number of ops:  12
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV_INIT                                        !0      null
   16     1        ASSIGN_OBJ                                               '_attributes'
          2        OP_DATA                                                  !0
   17     3        NEW                                              $3      'Db'
          4        DO_FCALL                                      0          
          5        ASSIGN_OBJ                                               'Db'
          6        OP_DATA                                                  $3
   18     7        INIT_FCALL                                               'print_r'
          8        FETCH_THIS                                       ~5      
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                                 
   19    11      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HtlAU
function name:  __get
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        FETCH_OBJ_R                                      ~1      '_attributes'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
   24     4*     > RETURN                                                   null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HtlAU
function name:  __set
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        FETCH_OBJ_W                                      $2      '_attributes'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   29     5      > RETURN                                                   null

End of function __set

Function authcheck:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 36
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 25
Branch analysis from position: 19
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HtlAU
function name:  AuthCheck
number of ops:  38
compiled vars:  !0 = $models
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_IS                                         ~1      '_COOKIE'
          1        ISSET_ISEMPTY_DIM_OBJ                         1  ~2      ~1, 'user'
          2        BOOL_NOT                                         ~3      ~2
          3      > JMPZ                                                     ~3, ->36
   32     4    >   INIT_METHOD_CALL                                         'LoadUser'
          5        CHECK_FUNC_ARG                                           
          6        FETCH_FUNC_ARG               global              $4      '_COOKIE'
          7        FETCH_DIM_FUNC_ARG                               $5      $4, 'user'
          8        SEND_FUNC_ARG                                            $5
          9        DO_FCALL                                      0  $6      
         10        ASSIGN                                                   !0, $6
   33    11        FETCH_IS                                         ~8      '_COOKIE'
         12        ISSET_ISEMPTY_DIM_OBJ                         1  ~9      ~8, 'user'
         13        BOOL_NOT                                         ~10     ~9
         14      > JMPZ_EX                                          ~10     ~10, ->19
         15    >   FETCH_IS                                         ~11     '_COOKIE'
         16        ISSET_ISEMPTY_DIM_OBJ                         1  ~12     ~11, 'hash'
         17        BOOL_NOT                                         ~13     ~12
         18        BOOL                                             ~10     ~13
         19    > > JMPZ_EX                                          ~10     ~10, ->25
         20    >   FETCH_R                      global              ~14     '_COOKIE'
         21        FETCH_DIM_R                                      ~15     ~14, 'hash'
         22        FETCH_OBJ_R                                      ~16     !0, 'access_token'
         23        IS_EQUAL                                         ~17     ~15, ~16
         24        BOOL                                             ~10     ~17
         25    > > JMPZ_EX                                          ~10     ~10, ->31
         26    >   FETCH_OBJ_R                                      ~18     !0, 'uid'
         27        FETCH_R                      global              ~19     '_COOKIE'
         28        FETCH_DIM_R                                      ~20     ~19, 'user'
         29        IS_EQUAL                                         ~21     ~18, ~20
         30        BOOL                                             ~10     ~21
         31    > > JMPZ                                                     ~10, ->34
   34    32    > > RETURN                                                   <true>
   33    33*       JMP                                                      ->35
   36    34    > > RETURN                                                   <false>
   31    35*       JMP                                                      ->37
   38    36    > > RETURN                                                   <false>
   39    37*     > RETURN                                                   null

End of function authcheck

Function loaduser:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HtlAU
function name:  LoadUser
number of ops:  13
compiled vars:  !0 = $uid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
   42     1        INIT_FCALL                                               'print_r'
          2        FETCH_THIS                                       ~1      
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   43     5        FETCH_OBJ_R                                      ~3      'Db'
          6        INIT_METHOD_CALL                                         ~3, 'fp'
          7        SEND_VAL_EX                                              'SELECT+%2A+FROM+users+WHERE+uid+%3D+%3F'
          8        INIT_ARRAY                                       ~4      !0
          9        SEND_VAL_EX                                              ~4
         10        DO_FCALL                                      0  $5      
         11      > RETURN                                                   $5
   44    12*     > RETURN                                                   null

End of function loaduser

Function loadusersall:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HtlAU
function name:  loadUsersAll
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   FETCH_OBJ_R                                      ~0      'Db'
          1        INIT_METHOD_CALL                                         ~0, 'fALL'
          2        SEND_VAL_EX                                              'SELECT+%2A+FROM+users'
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   48     5*     > RETURN                                                   null

End of function loadusersall

End of class Model.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
127.95 ms | 1010 KiB | 15 Q