Re: heredocs and numbers in indexes



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

$content =<<<content
$array[1a]
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
$D[some_var]
content;

yields this: .99

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

Jeff

Greetings,
Thomas


what OS are you running on ?

some flavor *nix.

head litenup.ca ?

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

Jeff

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
$a
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
}

funky.

Jeff

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.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: heredocs and numbers in indexes
    ... yields this: .99 ... This is on the "special projects" server at Blue Genesis because they don't run the MySQL PDO drivers on their normal server. ...
    (comp.lang.php)
  • Re: E-mail
    ... Select the mail account you want to fix. ... check the server, and the username to make sure they are correct. ... choose Use Secure Connection SSL encryption ... Under Authentication type choose password. ...
    (Fedora)
  • Wolfpack 4.3.11 Server Release
    ... We are happy to announce that Empire 4.3.11 is now available. ... Rewrite the client's code to read server output during login. ... Fix xdump not to deny access to game state tables when maximum ... Fix bug in path command that made it swallow every other step. ...
    (rec.games.empire)
  • Re: Cannot create sites from portal after applying patch http://su
    ... I am hoping that the fix is to W2k3 and not SharePoint Portal Server 2003, ... 2007 level products as well as the Office 2003 level product FrontPage 2003. ... Any word on a fix or did you figure out how to fix. ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Activated 2003SBS asking to be activated again?
    ... > even share with me what the cause or fix were. ... > obvious traces of what he did, and he couldn't divulge the details. ... >>> I'm not saying ignorance is bliss. ... >>> able to correct it without having to rebuild the entire server. ...
    (microsoft.public.windows.server.sbs)