RE: String format problem

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

 



On 31 August 2005 16:56, tg-php@xxxxxxxxxxxxxxxxxxxxxx wrote:

> $varname = '$firstname $lastname told me to find the file in folder
> C:\newtext\'; echo $varname;
> 
> 
> Yields..
> 
> $firstname $lastname told me to find the file in folder C:\newtext\

Actually, that'll give you an error as well, since \' is also an escape sequence (to get a single quote into a single-quoted string!). Currently, \' and \\ are the only escape sequences recognized in a single-quoted string, although this may change with the advent of native Unicode in PHP 6.

Bottom line: always double your backslashes, even in single-quoted strings, to be completely safe and future-proof.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
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