I have just started to learn Regular Expressions and I think this can be done using regex, but not able to find a proper regex match. Here is the situation: I want to fill the Key in the array with the respective values, but make everything lowercase and underscore for space.
Example PHP array:
array('' => 'Red Apple',
'' => 'Blue Sky',
'' => 'Circle/Earth');
Output should be:
array('red_apple' => 'Red Apple',
'blue_sky' => 'Blue Sky',
'circle_earth' => 'Circle/Earth');
I was able to use strtolower() but getting stuck with using preg_replace(). Can I even do this with regex?
Thanks.