php is numeric
snippet in php

check if string is number or not php

user1637

$var_num = "1";
$var_str = "Hello World";

var_dump( is_numeric($var_num), is_numeric($var_str) );

/* 
Output -
 bool(true)
 bool(false)
*/

php check if string or number

user6903

 <?php if (is_numeric(887)) { echo "Yes"; } else { echo "No"; } ?>

php is numeric

user2649

//is_numeric — Finds whether a variable is a number or a numeric string
is_numeric ( $variable ); // returns true or false

php is variable a number

user1875

if(is_numeric($what_am_i)){
	//true
}