Q:

php Overriding a value in a stdClass array

I have stdClass array like this 
stdClass Object
(
    [IS_ProductId] => 322
    [IS_ProductDesc] => 
    [IS_ProductName] => SMARTsite&trade; Setup/1x - 0699
    [IS_ProductPrice] => 699
)

Suppose I am getting the above array in a variable $product.
What I want to do is, I want to override the third keys value which is IS_ProductName
I want to pass it through html_entity_decode but when I do so I get the error message Cannot use object of type stdClass as array
I have tried 
$product->IS_ProductName = html_entity_decode($product[0]->IS_ProductName, ENT_QUOTES, 'utf-8');

How can I solve this ?? Any help please..

A:

You say that $product is the stdClass object. If so, you don't need the array access notation [0]. You get this right earlier in the line. Your code should look like this:
$product->IS_ProductName = html_entity_decode($product->IS_ProductName, ENT_QUOTES, 'utf-8');

(If you have an array of stdClass objects, you would then need the array access notation.)

