note 45119 added to function.preg-match
| From: | n0spm-kneufeld at usa dot net | Date: | Thu, 26 Aug 2004 16:12:03 +0000 |
| Subject: | note 45119 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75344@lists.php.net to get a copy of this message | ||
I too was trying to use preg_match in a switch and it wasn't working. Based on another comment
here I tried:
<?
switch ($var) {
case preg_match('/port/',$var) > 0:
# etc...
break;
}
?>
ie: add '> 0' to check for a match.
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45119
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45119&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45119&report=yes
Search -- http://master.php.net/manage/user-notes.php