Re: $request problem
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: $request problem

From: Anonymous <anonymous@nowhere.invalid>
Date: Tue Mar 14 2006 - 15:10:06 CET

ColdShine wrote:

> Here's a quick roundup, if you (or anyone f'wing this thread) still are
> wondering WHAT is meant WHEN:
>
> <?php
> $arr = array('key' => 'foo');
> define('key', 'another');
>
> echo $arr[key]; // undefined index ('another')
> echo $arr['key']; // foo
> echo '$arr[key]'; // $arr[key]

Ok, these results are obvious, IMHO.

> echo "$arr[key]"; // foo
> echo "$arr['key']"; // parse error

But these two are not. For the first case: Where in the manual does it
state that "$arr[key]" should be evaluated like $arr["key"]? For the
second: Within double quotes variables should be evaluated, so why
doesn't $arr['key'] evaluate to foo?

> echo "{$arr[key]}"; // undefined index ('another')
> echo "{$arr['key']}"; // foo
> ?>

Jep, these are obvious, too.

>
> This should rule out any misunderstandings.

Yes, it did. But it also brought up two new questions on my part. :-)
Received on Mon May 1 02:33:15 2006