Hi guys,
I would normally research this myself, but I am in a hurry just now.
My question is - how would I take a string like:
"Customer Name"
or
"Product Cost Price"
and produce a result where all upper case letters are made lower case and all spaces replaced by under-scores. Like this:
"Customer Name" would become "customer_name", and
"Product Cost Price" would become "product_cost_price"
Many thanks for any swift help,
S
Quick and dirty regex question
Moderator: General Moderators
Re: Quick and dirty regex question
Not regex, but this should do the job:
Code: Select all
strtolower(str_replace(' ', '_', $string))Re: Quick and dirty regex question
Thank you.Celauran wrote:Not regex, but this should do the job:
Code: Select all
strtolower(str_replace(' ', '_', $string))
Sorry to appear lazy, but I was in a mad rush.
S