Re: Problems with Arrays and print and echo
| From: | Michael Felt | Date: | Sat, 08 Apr 2006 12:53:28 +0000 |
| Subject: | Re: Problems with Arrays and print and echo | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233544@lists.php.net to get a copy of this message | ||
Michael Felt wrote:
OK . a rewrite, bit shorter...
1. A class construct with two arrays:
var $name;
var $ID;
function init($id) {
$this->name = array();
$this->ID = array();
....
# firther in code assignment done from a mysql database:
while ($max--)
read....
$this->name[$max] = $row[0];
$this->ID[$max] = $row[1];
$Name[$max] = $row[0];
$ID[$max] = $row[1];
}
and now some debug code....
print_r($this->name);
print_r($this->ID);
echo "\n$Name[5]\n";
echo "$this->name[5]\n";
echo "$this->ID[5]\n";
$a1 = $this->name;
$a2 = $this->ID;
echo "\n$a1[5] $a2[5]\n";
================
Output:
Array
(
[6] => 8-TFDX
[5] => B-E3KQ
[4] => BR-6XP
[3] => G5ED-Y
[2] => O-LR1H
[1] => UL-4ZW
[0] => Y5J-EU
)
Array
(
[6] => 30000312
[5] => 30000307
[4] => 30000311
[3] => 30000310
[2] => 30000309
[1] => 30000313
[0] => 30000308
)
B-E3KQ
Array[5]
Array[5]
B-E3KQ 30000307
chris smith wrote:var $name = array(); (or '' or ....) ? -- Postgresql & php tutorials http://www.designmagick.com/