RE: [PHP] String format problem

From: Date: Thu, 01 Sep 2005 13:07:04 +0000
Subject: RE: [PHP] String format problem
Groups: php.general 
Request: Send a blank email to php-general+get-221683@lists.php.net to get a copy of this message
On 31 August 2005 16:56, tg-php@gryffyndevelopment.com 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@leedsmet.ac.uk 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

« previous php.general (#221683) next »