Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Extract Numbers From a String in PHP

phpCopy<?php 
$string = 'Sarah has 4 dolls and 6 bunnies.';
$outputString = preg_replace('/[^0-9]/', '', $string);  
echo("The extracted numbers are: $outputString 
"); 
?> 
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Extract #Numbers #From #String #PHP
ADD COMMENT
Topic
Name
6+5 =