RE: [PHP] Array --> If
| From: | Erik Osterman | Date: | Sat, 08 Nov 2003 21:29:19 +0000 |
| Subject: | RE: [PHP] Array --> If | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168936@lists.php.net to get a copy of this message | ||
Sounds like what you want is the "in_array" function.
http://us4.php.net/manual/en/function.in-array.php
$cases = array( 5, 15, 30, 60, 90, 120 );
if ( in_array($count, $cases) ) {
EXECUTE PAGE
}
Regards,
Erik Osterman
http://osterman.com/
-----Original Message-----
From: Jason Williard [mailto:jason@janix.net]
Sent: Wednesday, November 05, 2003 6:42 PM
To: php-general@lists.php.net
Subject: [PHP] Array --> If
I am building a script that I would like to have do a specific task
based on whether specific counts have been reached.
Basically, the script checks for connectivity in a specific port. If
the connectivity fails, it increases the count by 1. It does this every
minute. I would like the script to page me at specific marker points
(i.e. 5, 15, 30, 60, 90, 120, etc). Is there anyway to make an if
statement or something similar to run in any case where the COUNT value
equals one of the numbers in the array?
Example:
$cases = array( 5, 15, 30, 60, 90, 120 );
if ( $count = {ITEM IN $cases} ) {
EXECUTE PAGE
}
Thanks,
Jason Williard
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php