php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3281 Array handling returns "Array" or does something stupid when keys are strings
Submitted: 2000-01-22 13:47 UTC Modified: 2000-01-22 21:49 UTC
From: johnston at itactics dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (22/01/2000) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: johnston at itactics dot com
New email:
PHP Version: OS:

 

 [2000-01-22 13:47 UTC] johnston at itactics dot com
<?php
        $a[b]['a c'] = "lala";
        echo "$a[b]['a c']";
?>

returns "Array"

<?php
        $z['hello baby'] = "yo";
        $z['bubye baby'] = "bah";
        array_keys($z);
?>

doesnt even return anything.

I'm trying to write a script that parses out a mail header into $message[header][headername] = "value";
and headername might be a few words or might have some weird chars in it and php's buggy arrays are causing me grief - lots of grief.  It wouldnt even matter if i removed all weird characters.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-01-22 21:02 UTC] johnston at itactics dot com
<?php
	$[b]['a c'] = "lala";
              echo "$a[b]['a c']";
?>

returns "Array"

<?php
	$z['hello baby'] = "yo";
	$z['bubye baby'] = "bah";
	print array_keys($z);
?>

also, returns "Array"

I'm trying to write a script that parses out a mail header into $message[header][headername] = "value"; and headername might be a few words or might have some weird chars in it and php's buggy arrays are causing me grief - lots of grief.  It wouldnt even matter if i removed all weird characters.
 [2000-01-22 21:49 UTC] torben at cvs dot php dot net
These are not bugs; both behaviours are explained in the manual. They
result from PHP not being able to simply echo or print an array; if you
try it, PHP prints out 'Array' to let you know that you've tried to do that.

The first issue is related to the problem of interpreting array syntax
inside encapsulating strings; this and the above are discussed at:

   http://www.php.net/manual/language.types.array.php3

The second issue stems from the fact that array_keys() returns the keys
as an array, which again cannot simply be echoed out:

   http://www.php.net/manual/function.array-keys.php3
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC