> why does this
>
> <?php
> $string = "this is my string.";
>
> print $string . "<br>\n";
>
> $string = preg_replace(
>                         array( '/is/', '/string/'    ),
>                         array( 'is not', 'bit of text' ),
>                         $string
>                       );
>
> print $string . "<br>\n";
> ?>
>

This happens because you are replacing  "is" with "is not" so parse your
string by hand:

"this is my string"..ok the first occurence of "is", is in the word "this",
so do the replace..the replaced part in CAPS:
"thIS NOT" .. then the second "is":
thIS NOT IS NOT" etc..I think you can see why now..

- John Vanderbeck
- Admin, GameDesign



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to