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.';
preg_match_all('!d+!', $string, $matches);
print_r($matches); 
?> 
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Extract #Numbers #From #String #PHP
ADD COMMENT
Topic
Name
7+3 =