Welcome Guest, Not a member yet? Register   Sign In
How to identify if an array has been defined?
#5

[eluser]BrianDHall[/eluser]
You can also use the empty function, which works on arrays as you would expect it would (an empty array is, predictably, empty, but if it is not set at all it will still return in an expected fashion and not throw any errors):

Code:
if (empty($data['agent']))
{
foreach..

Be careful of isset(), because a variable containing an empty string, or null, or an array with no elements, or an array element that is set but contains nothing, will all returning true as being 'set'.


Messages In This Thread
How to identify if an array has been defined? - by El Forum - 11-03-2009, 05:06 PM
How to identify if an array has been defined? - by El Forum - 11-03-2009, 05:26 PM
How to identify if an array has been defined? - by El Forum - 11-03-2009, 05:30 PM
How to identify if an array has been defined? - by El Forum - 11-03-2009, 05:59 PM
How to identify if an array has been defined? - by El Forum - 11-03-2009, 06:09 PM
How to identify if an array has been defined? - by El Forum - 11-03-2009, 07:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB