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

Posted by Captain Paralytic on 02/08/07 10:35

On 8 Feb, 10:25, "Captain Paralytic" <paul_laut...@yahoo.com> wrote:
> On 8 Feb, 08:08, "deko" <d...@nospam.com> wrote:
>
>
>
>
>
> > 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 ('&')?
>
> > $refurl = trim(getenv("HTTP_REFERER"));
> > $refhost = parse_url($refurl);
> > $refhost = preg_replace("\&\", "\&\", $refhost);
>
> > This code returns a warning and an error:
>
> > Warning: Unexpected character in input: '\' (ASCII=92) state=1 in ...
>
> > Parse error: parse error, unexpected ';' in ...
>
> > Thanks in advance.
>
> Why not just use str_replace- Hide quoted text -
>
> - Show quoted text -

Actually thinking about it further, why aren't you using
htmlentities() or htmlspecialchars()?

 

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

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