Afficher un message
Vieux 12/09/2007, 21h00   #5
ZeldorBlat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: multiple test (regexp)

On Sep 12, 2:54 pm, pepper.gabri...@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?


No regex needed -- just good old str_replace():

$b = str_replace(array('&', '?', '*'), '%26', $a);

  Réponse avec citation
 
Page generated in 0,05989 seconds with 9 queries