I have string contain numbers. I only want to get numbers. please help. Thank guys.
<?php
$a = '<td>15</td>';
?>
I have string contain numbers. I only want to get numbers. please help. Thank guys.
<?php
$a = '<td>15</td>';
?>
preg_match_all
will help you. See this.
$a = '<td>15</td>';
preg_match_all('!\d+!', $a, $matches);
print_r($matches);
I think using strip_tags
is the good way.
http://php.net/manual/fr/function.strip-tags.php
<?php
$a = '<td>15</td>';
$number = strip_tags($a);
?>