php - Preg_match symbols using? -


in code

<div class="count">#3</div><div class="count">#4</div><div class="count">#5</div> 

the numbers different every time how can see them , sum tested with

$b = explode('</div><div class="count">', $cnt); for($i=1;$i<sizeof($b);$i++)     preg_match("/([0-9]+)/", $b[$i], $m); 

but see numbers not sum :(

you don't need regular expressions even:

echo array_sum(str_split(filter_var($string, filter_sanitize_number_int))); 

outputs

12 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -