how to check if PHP variable contains non-numbers?
snippet in php

how to check if PHP variable contains non-numbers?

user9522

if ( is_numeric($_POST['foo']) ) {
    $foo = $_POST['foo'];
} else {
    // Error
}