Jump to content

how do I


Monkuar

Recommended Posts

use the in_array to check a loop ?

 

 

like

 

 

$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
    echo "Got Irix";
}
if (in_array("mac", $os)) {
    echo "Got mac";
}

 

 

Now what if $os becomes

 

 

for ($i = 1; $i <= 10; $i++) {
    $os .= $i
}

 

now if I use:

if (in_array($FORMPOST[couldbeanything], $os)) {
    echo "Correct entry";
exit;
}
if (!in_array($FORMPOST[couldbeanything], $os)) {
    echo " bad entry ";
exit;
}

 

 

would it work only through 1-10 numbers?  :shrug: :shrug: :shrug: :shrug: and echo out "bady" entry if it's NOT 1-10 ?

Link to comment
https://forums.phpfreaks.com/topic/259315-how-do-i/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.