note 94109 deleted from function.strspn by danbrown
| From: | danbrown@php.net | Date: | Fri, 16 Oct 2009 17:56:59 +0000 |
| Subject: | note 94109 deleted from function.strspn by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161817@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Another way to describe strspn() is by analogy to regular expressions:
<?php
// where ... is the $mask of characters to match
preg_match("/^[ ... ]*/", substr($subject, $start, $length) );
?>
strspn() returns the number of characters matched, with zero indicating no match whatsoever, and
$length indicating a complete match. Any other value indicates a partial match, which may or may
not be useful depending on your needs.