I’ve an array like this ,i want to strip all alpha characters.
$testString = Array ([0] => 46_xsdfdsa_ddasdasd [1] => 23423_wrwerwer_ajbfdahbfkahflagassl);
echo preg_replace("/[^0-9,.]/", "", $testString);
Output should be 46,23423.
I tried above and it did n’t work.
Thanks in-advance
This should work:
FYI, alphanumeric means alpha + numeric characters. From your question title, you seem to suggest that you want to replace them all. Let’s know if this works for you.
If in the output you only want numbers,
,., this is what you would do:Example:
Working Example