I had a parrot idea whilst writing this.. (see bottom)

Giles wrote:
Hi Guys

Really simple question. How do I change the following:

print("value='" . $attributes["messageSubject"] . "'");

to have double quotes around the subject field instead. i.e.:

print("value="" . $attributes["messageSubject"] . """);

you have to escape the doublequotes in question - this is done with a backslash:

print("value=\"" . $attributes["messageSubject"] . "\"");

or like this if you find it more readable (avoids the backslashes):

printf('value="%s"', $attributes["messageSubject"]);

actually you can do loads of funky things with printf() and its brother
sprintf() etc - check out the manual for all the formating codes (e.g. '%s')
that  are available

lastly, learn what string interpolation is and why it is technically
neater to only use doublequotes to delimit your php strings when you
want/require string interpolation to happen.


--- ParrotTalk: I think that this topic of string interpolation/quotes deserves 'parrot' attention.... which made me think that maybe the parrot could parse for markers (that if added to an email by an autorized poster) would mark the post/thread as suitable material for 'training' the 'parrot'





thanks

Giles Roadnight
http://giles.roadnight.name


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



Reply via email to