You are here: Re: How To Handle a String Containing Apostrophes and Quotation Marks « PHP Programming Language « IT news, forums, messages
Re: How To Handle a String Containing Apostrophes and Quotation Marks

Posted by Jerry Stuckle on 11/14/07 04:14

Lucanos wrote:
> Hey Guys,
>
> Probably a simple question, but one I am struggling with all the same.
> I know that in PHP you wrap a text string in apostrophes or quotations
> - (examples $variable = 'this string' OR $variable = "that string" ).
>
> What I am trying to figure is how to handle a string which contains
> both apostrophes and quotations already. Is there a something like
> CDATA is for XML?
>
> Thanks
> Luke
>
>

Escape them with backslashes, i.e.

echo 'It\'s a boy!";
echo "He said \"Here we go again!\"";

It's a boy!
He said "Here we go again!"

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация