RE: [PHP] echo only displays first character
| From: | Mal McKay | Date: | Fri, 16 Mar 2001 16:03:15 +0000 |
| Subject: | RE: [PHP] echo only displays first character | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44302@lists.php.net to get a copy of this message | ||
Are you sure $name is an array. t appears to be a string and the $name[$i]
references one character in that string
mal
-----Original Message-----
From: Tom Harris [mailto:stry_cat@yahoo.com]
Sent: 16 March 2001 15:50
To: php-general@lists.php.net
Subject: [PHP] echo only displays first character
Here's an interesting problem.
The following only prints the first letter of the name
for ($i=0; isset($empid[$i]); $i++) {
echo "$empid[$i] $name[$i]<br>";
}
But if I change the variable $name to $employeename throughout the script it
displays fine.
$empid[] and $name[] are both assigned earlier in the script by pulling data
from a MySQL database.
Is $name a reserved word or something? Anyone know why just changing the
array's name fixes the problem?
Thanks,
-Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net