Hi all
how can i get number(positive num) from string,if string syntax is the following:
t_def_type_id_2
t_def_type_id_22
t_def_type_id_334
so,in the first string i want to get 1,and in the second i want to get 22 and in the third string i want to get 334 using preg_match_all or any other sutable php function
You can use the regex
\d+$
with preg_match
if there is only one number in the string, simply use \d+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With