ID:               28920
 Updated by:       [EMAIL PROTECTED]
 Reported By:      klaus_kuehne at t-online dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Win 2000
 PHP Version:      4.3.6
 New Comment:

. 


Previous Comments:
------------------------------------------------------------------------

[2004-06-28 07:12:29] klaus_kuehne at t-online dot de

Sorry, there was no reason for my bug report: get_browser() returns an
object, no array. But here is a little bug in the
FOREACH-documentation:

"foreach works only on arrays, and will issue an error when you try to
use it on a variable with a different data type or an uninitialized
variable."
We ca see, it works on onjects, too.

Klaus Kühne

------------------------------------------------------------------------

[2004-06-25 13:50:26] klaus_kuehne at t-online dot de

Description:
------------
Hello,

following happens in PHP 4.3.6:
(1)
$browser = get_browser();
foreach ($browser as $key => $val) print "$key = $val, ";
delivers: ..., cookies = 1, ... (correctly)
(2)
$browser = get_browser();
print $browser["cookies"];
delivers NULL !!!! 
(3)
$browser = get_browser();
$arr = array();
foreach ($browser as $key => $val) $arr[$key] = $val;
print $arr["cookies"];
delivers 1.

I don't understand the NULL-result of (2).

Greetings Klaus Kühne



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28920&edit=1

Reply via email to