0

I have a simple preg_match statement... When I test this on eg. regex101.com, everything that I want gets selected. But when I set this to my script it brings nothing!

$params['filename'] = "2013-00049_20130830.pdf";
$pattern = '/([0-9]{4,8})/gm';
preg_match( $pattern, $params['filename'], $tmp);
print_r($tmp);

What I expact is an array like

Array
(
    [0] => 2013
    [1] => 00049
    [2] => 20130830
)

but there is not such thing... what am I doing wrong ???

Dwza
  • 6,494
  • 6
  • 41
  • 73

0 Answers0