i have a problem with the usage of stdClass.
From a SOAP based web service i get a code list as an array of
stdClass instances:
array (
0 =>
stdClass::__set_state(array(
'value' =1,
'name' ='APP_STATUS_1',
'description' ='status 1',
)),
1 =>
stdClass::__set_state(array(
'value' =2,
'name' ='APP_STATUS_1',
'description' ='status 2',
)),
2 =>
stdClass::__set_state(array(
'value' =3,
'name' ='APP_STATUS_3',
'description' ='status 3',
)),
3 =>
stdClass::__set_state(array(
'value' =4,
'name' ='APP_STATUS_ARRIVED',
'description' ='eingegangen',
)),
)
I'm looking for a specific code list item by iterating over the code
list:
foreach ($codelist as $item)
{
if ($item->value ==
$target_value) // <--- this produces the PHP
notice
{
$app_status_text = $item->description;
break;
}
}
When i run if ($item->value == $target_value) i get the PHP notice:
PHP Notice: Object of class stdClass could not be converted to int
Why PHP throws this notice. What i'm doing wrong when accesing $item-
>value.Thanks for any anwers,
Jean Marie