I want to extract the digits from a string that contains numbers and letters like:
"In My Cart : 11 items"
I want to extract the nu
we can extract int from it like
$string = 'In My Car_Price : 50660.00';
echo intval(preg_replace('/[^0-9.]/','',$string)); # without number format output: 50660
echo number_format(intval(preg_replace('/[^0-9.]/','',$string))); # with number format output :50,660
demo : http://sandbox.onlinephpfunctions.com/code/82d58b5983e85a0022a99882c7d0de90825aa398