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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
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

Pull Requests

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 Dec 21 14:01:32 2024 UTC