Page 1 of 1
check if var initialized?
Posted: Mon May 12, 2003 1:16 pm
by Dark_Raider
how do i check if a variable is initialized? i have an array and keep getting uninitialized string offset error. isset, is_null, anything else i can think of, doesnt work. please help.
Posted: Mon May 12, 2003 1:30 pm
by Coco
tried empty()?
tried if($var=='')?
Posted: Mon May 12, 2003 1:32 pm
by Dark_Raider
yeah ive tried both (oh and i dont wanna use the @ to supress the error)
Posted: Mon May 12, 2003 1:34 pm
by Dark_Raider
i think that in $proj["est"][$i] all of the values for $i are set but they just arent initialized. in other words the array elements were created but nothing was ever put into them.
Posted: Mon May 12, 2003 1:44 pm
by volka
there are three levels you might check.
Code: Select all
if ( isset($proj) && is_array($proj) )
{
if ( isset($proj["est"]) && is_array($proj["est"]) )
{
if ( isset($proj["est"][$i]) )
echo $proj["est"][$i];
}
}