You are here: Re: preg_replace question - ASCII characters? « PHP Programming Language « IT news, forums, messages
Re: preg_replace question - ASCII characters?

Posted by Petr Vileta on 02/08/07 12:53

"deko" <deko@nospam.com> píse v diskusním príspevku
news:RMednRMe2_RoRFfYnZ2dnUVZ_smonZ2d@comcast.com...
>I need to capture referrers to a website and populate a page with links to
>the referring pages.
>
> How do I use preg_replace to search for and replace all ampersands ('&')
> with the corresponding HTML special character ('&amp;')?
>
> $refurl = trim(getenv("HTTP_REFERER"));
> $refhost = parse_url($refurl);
> $refhost = preg_replace("\&\", "\&amp;\", $refhost);
>

$refhost = preg_replace('/\&/', '\&amp\;', $refhost);

Note - I use single quotes.

--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)

 

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

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