This is the class that I have created in PHP
class userinfo
{
public $username;
public $totalscore;
public $userid;
}
The code below is in a finite loop, and i
is set to 0
before entering the loop. And the variable user_array
is defined to be an array using the following code:
$user_array = array();
(some code here...)
$i++;
$user_array[i] = new userinfo();
$user_array[i]->totalscore = $stattotal;
$user_array[i]->userid = $id;
For some reason I cant understand why this wont work. I need to create an array of objects. And each object must hold three variables. How do I go about doing so ?
Thank you in Adv. for your Help !