Array issue

Hi all,

I have this code:


$data = file_get_contents('http://www.example.com');
$regex = '/(.+?) inschrijvingen/';
preg_match($regex,$data,$match);
$aantal_inschrijvingen = substr($match[0], -10, 4);

The page gives me an error : Undefined offset 0.

Does anybody see what is the issue here? The $match from the reg expression code gives me an array, so [0] sould give me the full content, right?

All help appreciated,
Michel

If the pattern doesn’t match anything, then $match will be an empty array.