I am trying to count how many times number appears in a string. For example, in the string "rt_876_io_542_po_367" there are three numbers and in the string "tr_766_ 756" there are two numbers. How do I do this with PHP?? I tried the following code:
$str="RT_657_YT_89";
$key=preg_match_all('!/_[0-9]_/!',$str);
echo $key;
but it echos "0"!! please help