Fri, 17 May 2024
NetArt Media     Pay 2, Get 3!    


How to remove symbols which are not digits from a string?

By: Nathalie, NetArt Media
Mon, 28 March 2022

In order to do this you may use the following regular expression:

<?php
....
$strOutput = ereg_replace("[^[:digit:]]", "", $strInput);
...
?>

In this case for example if Input is 43~34^67, the output will be:
433467


Category: PHP Examples
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox