You are here: Re: multiple test (regexp) « PHP Programming Language « IT news, forums, messages
Re: multiple test (regexp)

Posted by gosha bine on 09/12/07 19:52

pepper.gabriela@gmail.com wrote:
> Hello, I use this code:
>
>
> $a = "&&&&&& a b c d e f g";
> $b = ereg_replace ("&", "%26", $a);
>
> echo $b;
>
> to subtitute every "&" occurrence in $a.
>
> What if I want to change other occurrences of other chars at the same
> time?
> Say, I want to substitute "?", "*" and "°"...
>
> How can I do?
>

hi

it's not clear from your post what exactly you're after

maybe strtr function helps you

$trans = array(
'&' => "%26",
'?' => "%3F",
'%' => "%25",
);

echo strtr("a & b ? c % d", $trans);


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok

 

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

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