Re: [PHP] strange string evaluation



Marten Lehmann wrote:
Hello,

with PHP 5.0.x this two lines of code returned "{TEST}":

$var = "TEST";
print "\{$var}";

But with PHP 5.2.x, the same code returns "\{TEST}"

If I remove the backslash:

$var = "TEST";
print "{$var}";

then just "TEST" is return (without any brackets).

What is the recommended way for PHP 5.2.x to work with that? It looks a bid odd if I have to write

print "{". $var. "}";

instead.



$var = 'TEST';
print "{{$var}}";



.



Relevant Pages

  • Re: Get date from text/php-file
    ... because i think there should be some sort of php ... brackets in between there!? ... I'd think that there should be something after persoon= and after ...
    (comp.lang.php)
  • Strange IF(condition) behaviour
    ... I'm not sure if this is intended behaviour or not, but I can see that is ... Just thought I would bounce this to see what people think about ... This returns a parse error due to the fact there is no brackets around the ... the if is not php, then it terminates the if at the closing of the php tag. ...
    (php.general)
  • Re: evaluate expression inside array
    ... I've tried surrounding them with the brackets and ... double quotes too, to no avail. ... Sould this be possible in php? ...
    (comp.lang.php)
  • Re: What Id Like to see on TV....
    ... What sort of program about php do you want? ... Or in ye olde days ..... ... People didnt have any fear of ye olde version - but for whatever reason ... Perhaps its the brackets. ...
    (uk.media.tv.misc)
  • Re: Variable assignment using OR operator?
    ... Surely there is a construct for this in PHP? ... Michaels solution, while ... liner which does this lovely trick. ... > I believe it would work just like that, you might want brackets though: ...
    (comp.lang.php)