, - $ln, $ln, $phone $Email . , $i 0 , , mysql_fetch_array(), . , :
$tmp = 'A';
$tmp[0] = 'It does not matter how long this string is!';
echo $tmp;
, "I" .
:
$fn = $ln = $phone = $Email = array();
$i=0;
while($row = mysql_fetch_array($result)) {
$fn[$i] = $row ['FN'];
$ln[$i] = $row ['LN'];
$phone[$i] = $row ['Phone'];
$Email[$i] = $row ['Email'];
++$i;
}
, .
"" , .
.
class User {
public $first_name = '';
public $last_name = '';
public $phone_number = '';
public $email = '';
public function __construct($first, $last, $phone, $email) {
$this->first_name = $first;
$this->last_name = $last;
$this->phone_number = $phone;
$this->email = $email;
}
public function full_name() {
return $first_name . ' ' . $last_name;
}
}
while ($row = mysql_fetch_array($result)) {
$users[] = new User($row['FN'], $row['LN'], $row['Phone'], $row['Email']);
}
, IMHO, , , , .