note 90995 deleted from function.preg-match-all by danbrown

From: Date: Wed, 20 May 2009 13:17:17 +0000
Subject: note 90995 deleted from function.preg-match-all by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155785@lists.php.net to get a copy of this message
Note Submitter: tonicboy ---- @ad wow, that's very complex code for a simple function. why don't you just do: $clean = preg_replace("/[^0-9()\.\- ]/", "", $phone); i'm confused why you even want to keep any non-digit characters anyway. it's usually best practice to store phone numbers as digits-only. also, there's no need to use the multibyte version of strlen if you've just stripped out everything but single-byte characters. it's a small optimization but an optimization nonetheless.

« previous php.notes (#155785) next »