I am a C # guy trying to translate part of my understanding of OOP into php. I try to create my first class object and click on a few hooks.
Here is the start of the class:
<?php
require("Database/UserDB.php");
class User {
private var $uid;
private var $username;
private var $password;
private var $realname;
private var $email;
private var $address;
private var $phone;
private var $projectArray;
public function _construct($username) {
$userArray = UserDB::GetUserArray($username);
$uid = $userArray['uid'];
$username = $userArray['username'];
$realname = $userArray['realname'];
$email = $userArray['email'];
$phone = $userArray['phone'];
$i = 1;
$projectArray = UserDB::GetUserProjects($this->GetID());
while($projectArray[$i] != null) {
$projectArray[$i] = new Project($projectArray[$i]);
}
UserDB.php is where I have all my static functions interacting with the database for this user class. I get errors when using, when I use var, and I am embarrassed. I know that I donβt need to use var or declare variables at all, but I think this is better.
error "unexpected T_VAR awaiting T_VARIABLE"
When I just remove var from declarations, it works. Why is this?