- Original Message -
From: Dennis Moore <[EMAIL PROTECTED]>
To: Paul Roberts <[EMAIL PROTECTED]>; Lauri Vain
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: 12. siječanj 2002 23:33
Subject: Re: [PHP] multiple replaces...
> try str_replace() ... it allows yo
try str_replace() ... it allows you to pass an array into the replace
function.
/dkm
- Original Message -
From: "Paul Roberts" <[EMAIL PROTECTED]>
To: "Lauri Vain" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, January 12, 2002 4:35 P
have a look at eval()
Paul Roberts
[EMAIL PROTECTED]
From: "Lauri Vain" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 12, 2002 11:44 AM
Subject: [PHP] multiple replaces...
Hello there,
I have about 30 markers in the text which need to be replaced
quot;, "bar" => "banana");
$string = "I like foos and bars";
$string = strtr($string, $foo);
echo $string;
output:
I like apples and bananas
// Victor
- Original Message -
From: "'Nick Wilson'" <[EMAIL PROTECTED]>
To: <[E
And so does preg_replace() if you need any regular expressions.
Though str_replace() is probably faster when this is not the case.
http://www.php.net/manual/en/function.str-replace.php
http://www.php.net/manual/en/function.preg-replace.php
bvr.
--
PHP General Mailing List (http://www.ph
No need to loop. str_replace() already supports arrays!
check the manual.
bvr.
On Sat, 12 Jan 2002 12:57:10 -, DL Neil wrote:
>Yes, I thought about that. But, what should I do when the markers are absolutely NOT
>in any sequence.
>
>=sequence would matter if it was possible that one of
Yes, I thought about that. But, what should I do when the markers are absolutely NOT
in any sequence.
=sequence would matter if it was possible that one of the markers could replace some
text and that replacement
subsequently became the marker for a further replacement ... nightmare=recursion!
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* On 12-01-02 at 13:02
* Lauri Vain said
> Hi Nick,
>
> Yes, I thought about that. But, what should I do when the markers are absolutely NOT
>in any sequence.
>
> I also thought about something like
> $replace[1][1] = "!one!";
EMAIL PROTECTED]
Mobile: +372 53 410 610
-Original Message-
From: Nick Wilson [mailto:[EMAIL PROTECTED]]
Sent: 12. jaanuar 2002. a. 13:53
To: [EMAIL PROTECTED]
Subject: Re: [PHP] multiple replaces...
If the 'markers' are in some kind of sequence (like marker1, marker2
etc) yo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* On 12-01-02 at 12:49
* Lauri Vain said
> Hello there,
>
> I have about 30 markers in the text which need to be replaced with the value of a
>variable or an array.
>
> Common sense comes up with
>eregi_replace("!one!","blah",eregi_replac
10 matches
Mail list logo