On Friday 03 May 2002 12:51, Jason Soza wrote:
> Hoping someone can help me here. I'm working with someone else's code and
> I'm not familiar with ereg_replace(), can someone provide me an alternative
> to the following?
>
> ereg_replace("[^a-z0-9._]", "",
> ereg_replace (" ", "_",
> ereg_replace("%20", "_",
> strtolower($original_name))));
>
> Basically, I want to enter $original_name and have it come out $new_name,
> converting all spaces to underscores, upper to lowercase, and whatever that
> first line does. :)
>
> I've read through the manual and what I got was that preg_replace() is
> probably faster... Anyhow, I looked up preg_replace() and as a newbie to
> PHP, the given examples look like a language all their own.

What you're doing is not particularly complicated and can be done using 
str_replace().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
America, how can I write a holy litany in your silly mood?
                -- Allen Ginsberg
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to