Home / PHP Tips Generated By ChatGPT / Checking If a String Is Numeric in PHP Determine if a string is a valid number using is_numeric(). Source Code $var = "123"; if (is_numeric($var)) { echo "$var is numeric."; }