PHP, is_array() generating an "Undefined property: stdClass::$crit " error
Posted
by Brook Julias
on Stack Overflow
See other posts from Stack Overflow
or by Brook Julias
Published on 2010-06-15T13:38:22Z
Indexed on
2010/06/15
14:22 UTC
Read the original article
Hit count: 296
is_array($src2->crit)
is generating an "Undefined property: stdClass::$crit" error.
The line throwing the error is:
if(is_array($src2->crit) && count($src->crit) > 0){
$src2->crit
is initialized here.
$src2->crit = array();
$src2->crit[0] = new dataSet();
$src2->crit[0]->tblName = $tbl2;
$src2->crit[0]->colName = "ID";
$src2->crit[0]->val = $elm->editID;
When testing $src2->crit
with this code.
print("\$src->crit is a ".$src->crit."<br />");
print_r($src->crit); print("<br />");
This is returned.
$src2->crit is a Array
Array ( [0] => dataSet Object ( [tblName] => sExam [colName] => ID [val] => 10 ) )
What am I not seeing/understanding correctly? If print("\$src2->crit is a ".$src->crit."<br />")
returns that it is an array then why is is_array($src2->$crit)
generating an error?
© Stack Overflow or respective owner