How to Find Number from String in PHP?
Hello all! In this article, we will talk about how to find number from string in php. we will help you to give example of php get number from string. This article goes in detailed on php extract number from string. This article goes in detailed on php read number from string. So, let's follow few step to create example of php take number from string.
Here, i will give you simple example how to get number value from string content in php. so let's see both code and output as bellow:
$string = 'You have 500 Dollar and 13 Rupees';
preg_match_all('!\d+!', $string, $matches);
 => 500
 => 13
i hope it can help you...
We are Recommending you
- How to get HTML Tag Attribute Value in PHP?
- How to Get HTML Tag Value in PHP?
- PHP Calculate Time Difference Between Two Dates in Hours Example
- PHP Generate QR Code using Google Chart API Example
- PHP Array Get Previous Element from Current Key
- PHP Explode Every Character into Array Example
- PHP Remove Element from Array by Value Example
- PHP Curl Request with Username and Password Example
- How to check word exist in string or not in PHP?
- How to convert array values to lowercase in PHP?