note 83553 added to function.ereg-replace
| From: | Oppermann at osu1 dot php dot net | Date: | Sat, 31 May 2008 14:35:00 +0000 |
| Subject: | note 83553 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140031@lists.php.net to get a copy of this message | ||
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
?>
----
Server IP: 87.54.44.10
Probable Submitter: 80.163.32.238
----
Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php
Edit -- https://master.php.net/note/edit/83553
Del: integrated -- https://master.php.net/note/delete/83553/integrated
Del: useless -- https://master.php.net/note/delete/83553/useless
Del: bad code -- https://master.php.net/note/delete/83553/bad+code
Del: spam -- https://master.php.net/note/delete/83553/spam
Del: non-english -- https://master.php.net/note/delete/83553/non-english
Del: in docs -- https://master.php.net/note/delete/83553/in+docs
Del: other reasons-- https://master.php.net/note/delete/83553
Reject -- https://master.php.net/note/reject/83553
Search -- https://master.php.net/manage/user-notes.php