01-27-2008, 03:10 PM
|
#5 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
This is the code I would use to do it. However, although you can calculate the identifier on-the-fly, if you introduce any more characters into it then consider storing it in the database so you can be certain it can be reversed.
php Code:
class String { /* Bring on namespaces! */ public static function toSef ($szText) { $szText = str_replace(' ', '-', $szText); return preg_replace('~[^-a-z0-9]~i', '', $szText); }}echo String:: toSef('this is a "test"');
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|