Hi all,

I have the following code:

$gettotal = "<span class='totalpages'>";
$fine = preg_match("/^<span class='totalpages'>/", $gettotal, $matches);

When I print out the contents of the array though, it appears empty. Does anyone know why?

Thanks,
Mike

    I suspect you're forgetting that the output is a HTML tag, so won't show in the browser (unless you do a view source). Try this:

    <?php
    $gettotal = "<span class='totalpages'>";
    $fine = preg_match("/^<span class='totalpages'>/", $gettotal, $matches);
    printf("<pre>%s</pre>", htmlentities(print_r($matches, 1)));
    ?>
    
      Write a Reply...