Re: problem with intval [CONCLUSION]

From: Date: Thu, 23 Oct 2003 17:40:09 +0000
Subject: Re: problem with intval [CONCLUSION]
Groups: php.general 
Request: Send a blank email to php-general+get-167326@lists.php.net to get a copy of this message
Everybody: This problem solved. It is not PHP's fault, It is mine. When I fixed some problems that I thought where non intrusive in this problem, everything started working as a charm. Here is the finished function, it is part of a class called xValidate. function integer(&$msg, $prompt, $value, $min, $max, $name) { $number = intval($value); if ($value == "") { $msg[$prompt] = "You have to write a number in this field."; } elseif (!is_numeric($value)) { $msg[$prompt] = "The contents of this field should be a number."; } elseif ($value != $number) { $msg[$prompt] = "This number should be an integer."; } else { xValidate::number($msg, $prompt, $number, $min, $max, $name); } } and just for the curious here is xValidate::number... function number(&$msg, $prompt, $number, $min, $max, $name) { if (!empty($min) and ($number < $min)) { $msg[$prompt] = "This value should be a number greater than or equal to $min."; } elseif (!empty($max) and ($number > $max)) { $msg[$prompt] = "This value should be a number less than or equal to $max."; } } Thanks for your interest, Cesar.

« previous php.general (#167326) next »