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

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -