Re: problem with intval and !=

From: Date: Thu, 23 Oct 2003 15:51:35 +0000
Subject: Re: problem with intval and !=
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-167303@lists.php.net to get a copy of this message
On Thu, 2003-10-23 at 11:21, Cesar Cordovez wrote: > > At this point, I think I have to change the procedure. This is not > good. Any sugestions on how to now if the user types an integer number > in a field? > Here's a really simple way: if( ereg( '^[[:space:]]*[[:digit:]]+[[:space:]]*', $input ) ) { // Yaaaaaaay, integer input! } Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#167303) next »