Creating machine readable names from human readable.
Hello all,
Is there a Drupal or PHP function that will convert Human Readable names to Machine Readable names? I tried using preg_replace() but I was not able to figure out the pattern matching for it to work properly.
Thanks
Thank you for posting your solution! I've used something very similar to this in the past.
Hello all,
I found a way to do it. Not sure if it is the best, but at least it is short ;)
$machine_readable = strtolower($human_readable);
$machine_readable = preg_replace('@[^a-z0-9_]+@','_',$machine_readable);
Best regards,
Teze