Err:"Uninitialized string offset: 0" when doing count on multidim array
| From: | Timo Boettcher | Date: | Thu, 03 Apr 2003 13:47:40 +0000 |
| Subject: | Err:"Uninitialized string offset: 0" when doing count on multidim array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-142131@lists.php.net to get a copy of this message | ||
Hi!
I have an multidimensional array with contents like:
$myarr["url"][]="http://www.example.com";
$myarr["img"][]="http://www.example.com/test.gif";
$myarr["text"][]="example.com";
I want to display all entries like:
for ($i=0; $i<count($myarr["url"]); $i++) {
picturedlink($myarr["url"][$i],$myarr["img"][$i],$myarr["text"][$i]);
}
On the line with count I get an Error: "Uninitialized string offset: 0",
when I have
error_reporting(E_ALL);
for debugging. But it works as expected (returning 1 in this example).
As php considers this to be wrong, what would be right?
Of course, I could just switch error_reporting to some lower level - but how
would the clean solution look like?
Thanks
Timo
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!