/** * This function returns true if the variable is a number not starting with 0. * * @param $val The value to test. * @param $opts (not required) * @param $formelement (not required) * * @todo * Allows things other than digits */ function nonzero($val, $opts = '', $formelement = null) { $result = YDValidateRules::regex(strval($val), '/^-?[1-9][0-9]*/'); if ($result === true) { $result = YDValidateRules::numeric(strval($val), array()) ? true : false; } return $result; }
/** * This function returns true if the variable is a number not starting with 0. * * @param $val The value to test. * @param $opts (not required) * * @todo * Allows things other than digits */ function nonzero($val, $opts = '') { $result = YDValidateRules::regex($val, '/^-?[1-9][0-9]*/'); if ($result === true) { $result = YDValidateRules::numeric($val, array()) ? true : false; } return $result; }