oop - Why array is not full after initialization in constructor PHP? -


i have 2 classes php:

  1. profile
  2. publicprofile

at publicprofile class there are:

public function index($id){         $profile = new profile($id, true);         $profile->index(); } 

so, here create new object profile.

let's see class profile:

class profile extends auth {      public  $data = array();         public function __construct($iduser = null, $view = false){             parent::__construct();             $this->gettemplate();         }     } } 

the function gettemplate(); - forms array $this->data

if show @ once array after execute gettemplate(), see (via var_dump), array contains data keys:

  1. view_inside
  2. view

when called method $profile->index() - array not same:

method index in class profile:

public function index(){         var_dump($this->data); die(); // here there not keys view_inside, view         $this->route();     } 

what wrong @ code, source array in 1 class different @ 2 methods?

function gettemplate():

public function gettemplate(){                  $this->data['view_inside']   = 'profile/doctor/index';                 $this->data['view_left']     = 'profile/doctor/left';                 $this->data['view_edit']     = 'profile/doctor/personal_update';                  $this->data['view_personal'] = 'users/doctor/personal'; var_dump($this->data); // right } 


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -