"Shien Hang Low" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> >problem :
> >
> >code :
> ><?
> >$data= "message";
> >echo $data;
> >?>
> >
> >output :
> >message
> >-----------------------------------
> >if i want the output to be :
> >"message"
> >
> >i try to used the below code but fail:
> ><?
> >$data = ""message"";
> >echo $data;
> >?>
> >
> >so i wonder if i want to get the output that with the
> >'quatation' mark  how can i do it, your help means alot to me
> >thank you for your time and patient .


There are two ways of doing this:

First, you could use a literal string (using single-
quote marks ie ' )

$data = ' "message" ';


Secondly, you could escape the quotation marks
inside the string, ie

$data = " \"message\" ";


I find the first method is a little easier to
read; however, single-quoted strings are
not evaluated for variable substitution, ie

$insert = 'test';

// $data = ' "$insert" ';        // will not work!
$data = ' "' . $insert . '" ';
$data = " \"$insert\" ";


Hope this helps.


--
Hugh Bothwell     [EMAIL PROTECTED]     Kingston ON Canada
v3.1 GCS/E/AT d- s+: a- C+++ L++>+++$ P+ E- W+++$ N++ K? w++ M PS+
PE++ Y+ PGP+ t-- 5++ !X R+ tv b++++ DI+++ D-(++) G+ e(++) h-- r- y+




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

Reply via email to