note 83553 deleted from function.ereg-replace by bjori
| From: | bjori@php.net | Date: | Sat, 31 May 2008 19:22:09 +0000 |
| Subject: | note 83553 deleted from function.ereg-replace by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140033@lists.php.net to get a copy of this message | ||
Note Submitter: Oppermann
Reason: bad code
----
Let's say you only need all the digits in a string, then this is quite usefull:
<?php
$string = "Here is some text, numbers 12345 and symbols !£$%%%^&&&&";
$only_digits = ereg_replace("[^0-9]", "", $string);
echo $only_digits //This will echo 12345
?>