Welcome Guest, Not a member yet? Register   Sign In
Can you simplify this function?
#2

[eluser]TheLoops[/eluser]
If by "Replace multiple spaces/divisions/underscores" you mean "only if > 1 are found"…
… then try this combination:
Code:
$s = preg_replace('/( {2,}|-{2,}|_{2,})/', '_', $s); // Replace multiple spaces/divisions/underscores with a single underscore

… else try this:
Code:
$s = preg_replace('/[ \-_]+/', '_', $s); // Replace multiple spaces/divisions/underscores with a single underscore


Messages In This Thread
Can you simplify this function? - by El Forum - 05-17-2008, 08:03 AM
Can you simplify this function? - by El Forum - 05-17-2008, 08:56 AM
Can you simplify this function? - by El Forum - 05-17-2008, 09:18 AM
Can you simplify this function? - by El Forum - 05-17-2008, 05:59 PM
Can you simplify this function? - by El Forum - 05-18-2008, 12:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB