Is there any quick function that will convert: HtTp://www.ExAmPle.com/blah to http://www.example.com/blah
Basically I want to lower case the case-insensitive parts of a url.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since you asked for “quick,” here’s a one-liner that does the job:
Outputs:
EDIT/ADD:
I’ve tested, and this version is about 55% faster than using preg_replace_callback with an anonymous function: