How to detect number from string in php?

This post, we helps you check if a string contains numeric characters.

1. Code:

    <?php 
	function checkContainsNumbers($string){
		return preg_match('/\\d/', $string) > 0;
	}
	$str = "Soltuts.com 1 is providing PHP tutorials";
	var_dump(checkContainsNumbers($str));
	echo "<br>";
	$str = "Soltuts.com is providing PHP tutorials";
	var_dump(checkContainsNumbers($str));
    ?> 

2. Example:

Input:

 $str = 'Soltuts.com 1 is providing PHP tutorials';

Output:

bool(true)