- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$s = 'there is no spoon';
$matches = [];
preg_match('~(spoon|fiddle)~',$s,$matches);
var_dump($matches);
//seems that yes, we can reuse $matches.
preg_match('~(blah)~',$s,$matches);
var_dump($matches);