FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Verifying time in php
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Verifying time in php [message #179387 is a reply to message #179380] Sun, 14 October 2012 17:20 Go to previous messageGo to previous message
houghi is currently offline  houghi
Messages: 45
Registered: September 2011
Karma:
Member
houghi wrote:
> Valid?$hours $min $sec
> No - - -
> Yes 1 - -
> Yes 1 - 1
> Yes - 1 -
> Yes 1 1 1
> No A - -
> No 1 A -
> No 1A - -
>
> So I have to figure out if some are filled out and if they are, if they
> are digits. Looking around for 2 days now to make it intro something
> can read next week as well.
>
> I keep getting back to where I need to get through all options.
>
> So is_numeric is obvious as well as is_set, but is_set is not needed if
> others are set.

Found finaly the solution. Instead of looking at the seperate values and
then trying to combine them, it is better to combine them and then
evaluate them with
$testtime=$_POST['hours'].$_POST['minutes'].$_POST['seconds'];

$hours $min $sec $testtime Valid?
- - - - No
1 - - 1 Yes
1 - 1 11 Yes
- 1 - 1 Yes
1 1 1 111 Yes
A - - A No
1 A - 1A No
1A - - 1A No

That way I can just do a 'is_numeric($testtime)' and no need to use
is_set or anything else.

houghi
--
This is written under the inluence of the following:
> Artist : Nightwish
> Song : Reach (Amaranth Demo Version)
> Album : Amaranth
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Curl chmod file transfer problem...
Next Topic: test
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 09:06:52 GMT 2024

Total time taken to generate the page: 0.04535 seconds