a variable that is undefined

Links for php scripts

Moderators: egami, macek, gesf

Post Reply

Tue Jun 24, 2003 11:51 am

i want a variable that is undefined... um.. i dunt think u understand what i'm talking about. heres my script.

Code: Select all

$user[0] = "ff-dna";
$user[1] = "mysql";
$user[3] = "john";
if ($user[$number] == "$username") { echo "access granted."; } else { echo "access denied"; } ?>

for the $number variable, is there a variable that represents all numbers... as in every number.... or checks if its a number... anyone have any idea?

i appreciate any help/...

php-forum Active User
php-forum Active User
Posts: 264
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada

Tue Jun 24, 2003 12:06 pm


Tue Jun 24, 2003 5:21 pm

it didnt work out as i thought.... but thanks for your help... i'm new so i'm a lil dumb....

Code: Select all

$user[0] = "michael";
$user[1] = "weiyi";
$user[2] = "weiyia";
$cd = is_numeric($cd);
if ($username == "$user[$cd]") { echo "access granted"; } else { echo "access denied"; }

i'm trying to get more like um... whenever i put a username like $username = "weiyi"; i need something or some variables to check:


i need it to check all those....

New php-forum User
New php-forum User
Posts: 23
Joined: Tue Jun 24, 2003 4:49 am

Wed Jun 25, 2003 11:13 am

Perhaps you are looking for in_array then?
cf. http://www.php.net/in_array


Post Reply