Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Checking values in an array

Original Message
Name: joba
Date: May 3, 2007 at 06:48:22 Pacific
Subject: Checking values in an array
OS: win vista premium
CPU/Ram: intel 2 gb ram
Model/Manufacturer: hp
Comment:
Can a check on the value gender in an array be checked like this?

if (!isset(array['gender'])
//do so and so
} else {
//do so and so
};


Report Offensive Message For Removal


Response Number 1
Name: Laler
Date: May 3, 2007 at 15:04:01 Pacific
Subject: Checking values in an array
Reply: (edit)
nope, it should be like this:

$the_array = array ('name', 'gender', 'address');

if (!in_array ('gender', $the_array))
{ /* do so and so */ }
else { /* do so and so */ }

php.net is the best source for references

---
Fubar


Report Offensive Follow Up For Removal

Response Number 2
Name: Michael J (by mjdamato)
Date: May 4, 2007 at 00:37:20 Pacific
Subject: Checking values in an array
Reply: (edit)
First, you shuld always specify what language you are using - it could have been confused for Javascript.

Second you need to give an example of the array values. In your example you are testing to see if the array KEY 'gender' in the array has been set, it does nothing to determine the value of that array index.

Laler's example tests to see if the VALUE 'gender' exists for any of the keys within the array.

Michael J


Report Offensive Follow Up For Removal

Response Number 3
Name: Laler
Date: May 4, 2007 at 07:32:02 Pacific
Subject: Checking values in an array
Reply: (edit)
Michael is right, my answer above is by "assuming" so many things :D

---
Fubar


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Checking values in an array

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




DSHUB24 Connection Problems

need help with dsl and dial up

novel 3.12

help mandriva install last straw!

Icon Scaling in Explorer Bar


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC