RE: [PHP] character ' in switch

From: Date: Thu, 21 Nov 2002 12:59:23 +0000
Subject: RE: [PHP] character ' in switch
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-125408@lists.php.net to get a copy of this message
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/

« previous php.general (#125408) next »