php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8662 Echo of type "array of array"...
Submitted: 2001-01-11 16:52 UTC Modified: 2001-01-11 16:54 UTC
From: webmaster at scaninvestor dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.0.4 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: webmaster at scaninvestor dot com
New email:
PHP Version: OS:

 

 [2001-01-11 16:52 UTC] webmaster at scaninvestor dot com
$PHPsource = array( 
    "0"  => array( 
          "foo"  => "Hello", 
          "bar"  => "World" 
    ); 

echo "Hello: $PHPsource[0][bar]"; 

Sould be:
"Hello: world" 

But comes up:
"Hello: Array[bar]" 

This is working:
echo "Hello: ".$PHPsource[0][bar]; 

It seems like inside the " there is a problem identifying varibels the right way.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-11 16:54 UTC] cynic@php.net
Please, read the manual. 
If you want to have array indices inside strings, you must enclose them within curly braces:

echo "Hello: {$PHPsource[0][bar]}"; 

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 03:01:29 2024 UTC