NYCPHP Meetup

NYPHP.org

[nycphp-talk] New to group and array question

Chris Shiflett shiflett at php.net
Mon Sep 11 13:50:54 EDT 2006


David Mintz wrote:
> I thought PHP does not try to evaluate constants within
> double-quoted strings.

I've never tried it, but you're right:

<?php

define('index', 0);

$myarray[index] = '<p>constant</p>';
$myarray['index'] = '<p>string</p>';

echo "$myarray[index]";
echo "{$myarray[index]}";
echo $myarray[index];

?>

I still thinks it's a stretch to call this "kosher." Weird is what I
would call it. :-)

Chris

-- 
Chris Shiflett
Principal, OmniTI
http://omniti.com/



More information about the talk mailing list