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
 [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: Tue Apr 23 10:01:29 2024 UTC