note 78029 added to function.strstr
| From: | fire dot minded dot designatgmaildotcom at osu1 dot php dot net | Date: | Mon, 24 Sep 2007 23:06:03 +0000 |
| Subject: | note 78029 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130757@lists.php.net to get a copy of this message | ||
for eamon:
preg_replace is wonderful for that sort of thing, amongst so much else.
<?php
$string = "a string with!0o|u7t stuf34-f2~ in#4 in it";
// No numbers
$string = preg_replace("![0-9]!", "", $string);
// $string is now "a string with!o|ut stuf-f~ in# in it"
// Nothing but alphabetic
$string = preg_replace("![^0-9A-Za-z\s]!", "", $string);
// $string is now "a string without stuff in in it"
?>
----
Server IP: 69.147.83.197
Probable Submitter: 76.166.158.229
----
Manual Page -- http://www.php.net/manual/en/function.strstr.php
Edit -- https://master.php.net/note/edit/78029
Del: integrated -- https://master.php.net/note/delete/78029/integrated
Del: useless -- https://master.php.net/note/delete/78029/useless
Del: bad code -- https://master.php.net/note/delete/78029/bad+code
Del: spam -- https://master.php.net/note/delete/78029/spam
Del: non-english -- https://master.php.net/note/delete/78029/non-english
Del: in docs -- https://master.php.net/note/delete/78029/in+docs
Del: other reasons-- https://master.php.net/note/delete/78029
Reject -- https://master.php.net/note/reject/78029
Search -- https://master.php.net/manage/user-notes.php