Jump to content

Is there a better way?


cooldude832

Recommended Posts

I'm trying to come up with a list of banned numbers so to say that looks like this below

<?php
$badnums = array(1,2,4,5,7,8,23);
$num = $_SESSION['num'];
if($num != $badnums){
//Good
}
else{
//bad
}
?>

I know you can't do that so what I thought of was something else like

<?php
$badnums = array(1,2,4,5,7,8,23);
$num = $_SESSION['num'];
$badnums = implode("&&".$num."!= ".,$badnums);
if($num != $badnums){
//Good
}
else{
//bad
}
?>

Does that make sense? I think it would work but is there an easier way?

Link to comment
https://forums.phpfreaks.com/topic/61773-is-there-a-better-way/
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.