RE: [PHP] character ' in switch

From: Date: Thu, 21 Nov 2002 12:59:47 +0000
Subject: RE: [PHP] character ' in switch
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-125410@lists.php.net to get a copy of this message
Hi Ernest, I stand corrected. (I tend to standardise on double quotes where possible, and rarely use singles) Thanks for correcting me on this. Thanks David Russell IT Support Manager Barloworld Optimus (Pty) Ltd Tel: +2711 444-7250 Fax: +2711 444-7256 e-mail: DavidR@BarloworldOptimus.com web: www.BarloworldOptimus.com -----Original Message----- From: Ernest E Vogelsinger [mailto:ernest@vogelsinger.at] Sent: 21 November 2002 02:59 PM To: David Russell Cc: 'Martin Hudec'; 'PHP' Subject: RE: [PHP] character ' in switch At 13:16 21.11.2002, David Russell spoke out and said: --------------------[snip]-------------------- >Hi Martin, > >Just a thought - can't you escape it? > >switch ($_GET['action']) { > case "about": > code > break; > > case "what\'s new": <-- i want this... > code > break; > > default: > break; >} --------------------[snip]-------------------- You need to escape a quote if it's in a string that is quoted with the same quote: "Double quoted string needs to \"escape\" double quotes but not 'single quotes'" 'Single quoted string needs not to "escape" double quotes but \'single quotes\'" -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

Attachment: [application/x-pkcs7-signature] smime.p7s
« previous php.general (#125410) next »