php - The type of the third parameter in preg_match_all() when no matches are found -
i'm using preg_match_all()
in project find matches in given string. example:
preg_match_all( $pattern, $subject, $matches, $flags );
if matches found, $matches
parameter multidimensional array of matches ordered according $flags
.
if matches weren't found, type $matches
be? still array, albeit empty array, or else such false
or null
?
$matches array containing empty sub-array. it's can test yourself.
<?php preg_match_all('/o/', 'foo', $matches); var_dump($matches);
output:
array(1) { [0]=> array(0) { } }
Comments
Post a Comment