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
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: 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: Sun Dec 22 01:01:30 2024 UTC