Re: space replacement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, I think instead use preg_replace, I suggest use str_replace. Why?
>From PHP Manual:

******************************************************
str_replace
Replace all occurrences of the search string with the replacement string
(PHP 3 >= 3.0.6, PHP 4, PHP 5)

This function returns a string or an array with all occurrences of search in
subject replaced with the given replace value. If you don't need fancy
replacing rules (like regular expressions), you should always use this
function instead of ereg_replace() or preg_replace().
******************************************************

I think because str_replace can change character faster than preg_replace() 
or ereg_replace()

The example of this function (for you case) :

$str = "SITE OPTIMISATION TECHNIQUE";
$str = str_replace(" ", "-", $str);


LuckyGuy354
IT Beginner

http://www.wiwid.org

----- Original Message ----- 
From: "~Tarun~" <tarun.virgo@xxxxxxxxx>
To: <php-objects@xxxxxxxxxxxxxxx>
Sent: Saturday, March 10, 2007 7:41 PM
Subject: Re:  space replacement


> Hello Abhishek,
>
> Thanks alot dear.
>
> Regards
>
> Tarun


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux