Re: Re: Miserable escape string problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The escaping works fine for me.. using the code:

$var1 = 1;
$var2 = 3;

echo "\$var1: $var2";
print "\$var1: $var2";
print ("\$var1: $var2");

All output:

$var1: 3

as expected.

Is there a way to re-define the escape character or something?  I can't think of why that wouldn't escape the $ properly.

= = = Original message = = =

Well Kae, if you reply 3 times let me also reply you once.
What you try to suggest is a workaround. A workaround should
not be needed for such a basic thing. Ever.

The point is, \ should escape only the , just like
it does when you escape a variable like this "\$var1"
In this case, \ only escapes the $.

Even then, why does it output the \?
Try this:
=========================================================
$var1 = 1;
$var2 = 2;
print("\$var1: $var2");

=========================================================
It will output: \1: 2
Why the \? Isn't it an escape character.


If you try to get me thinking that this is normal behaviour,
let's agree to disagree.

PS: I'd like to see an insider comment on this, eventually
explain the thought behind this implementation.



Kae Verens wrote:
> because $var1 is a valid syntactical construct?
> 
> try this instead:
>  ''.$var1.': '.$var2.''
>
> Kae


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux