Re: Any difference between these 2 forms of syntax?

From: Date: Sat, 11 May 2002 01:04:23 +0000
Subject: Re: Any difference between these 2 forms of syntax?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-97054@lists.php.net to get a copy of this message
Richard Davey wrote:
Hi, I am wondering if there is any tangible difference between the following two commands: $x = $foo["status"]; $x = $foo['status']; The part in question being the use of ' or " around the "status" element of the array $foo. Both have the same end result in my case, I'm just purely wondering which is the correct form of syntax to use? Cheers, Rich -- Fatal Design http://www.fatal-design.com Atari / DarkBASIC / Coding / Since 1995
It all depends on what you use as a key... you just follow the normal string standards. If you want a variable evaluated within the key, then you must use "s if you purely use text then you just need 's. For example $x=$foo["status $y"]; vs. $x=$foo['status'];

« previous php.general (#97054) next »