Re: heredocs and numbers in indexes

Jeff wrote:
Jerry Stuckle wrote:
Jeff wrote:
Luuk wrote:
Jeff schreef:
Thomas Mlynarczyk wrote:
Jeff schrieb:

$content =<<<content

Why is that? Is there a fix other than renaming the indexes? {$array[1a]} or {$array['1a']} does not work.

{$array['1a']} works fine for me with PHP 5.2.0.

Thanks, I've got 5.2.6 here.

I've also some weird problem where with $ signs.

$D['some_var']= '$19.99';

echo <<<content

yields this: .99

Just looked at the php change log but it's a bit hard to parse!



what OS are you running on ?

some flavor *nix.

head ?

It's a Blue Genesis server, not a great host, if you ask me!


Works here, also. Is this the *exact* failing code?

As far as the original problem, yes. I ran a test script.

$a = '$19.99';

echo <<<this_data

I find that a stand alone works as expected. In the code block itself it fails. There's a bit of PDO before and not much else.

This is on the "special projects" server at Blue Genesis because they don't run the MySQL PDO drivers on their normal server. I wouldn't be surprised if there was a connection.

In fact, my "fix" for both bits is this:

foreach($D as $key=>$value){
$value = str_replace('$','',$value); // remove $
$D['x' . $key] = $value; // don't start index with a number



I understand what you're saying, but I suspect there's something else different in your code which is causing your problem (especially with the fix you have).

But as it's part of a larger code base (which you don't show), it's hard to tell just what is going on.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.