I typically call preg_match_all using $pattern
, $subject
, $matches
, like
preg_match_all("/\S/","words",$matches);
However, my IDE (Netbeans)
is yelling at me because $matches
(which is passed by reference and will be assigned the result of preg_match_all
) is undefined so it doesn't want me to pass it as a parameter. Its happy with something like:
$matches=[];
preg_match_all("/\S/","words",$matches);
However, this seems superfluous, and the examples on php.net do not define the variable ahead of time. What is the "proper" way to do this? Can I just ignore Netbeans
?