A function that returns an object?

There is an object $item->name, which returns the name of the product, how to get data $item->name through the function? So when I would go to functions, she gave me the name of the product ($item->name)
July 2nd 19 at 18:24
2 answers
July 2nd 19 at 18:26
res_name function($item){
 return $item->name;
}

$a = res_name($your_item);
your_item - what's that? - Deanna.Mertz commented on July 2nd 19 at 18:29
: this is your item which you passes in the function to return the desired object - Nathanial_Rath50 commented on July 2nd 19 at 18:32
Message: Trying to get property of non-object error - Deanna.Mertz commented on July 2nd 19 at 18:35
: so you do not have this property (name) - Nathanial_Rath50 commented on July 2nd 19 at 18:38
: Yes, it displays the product name, I need it in title if it is inserted as it is - will fail. Attached a screenshot of the answer - Deanna.Mertz commented on July 2nd 19 at 18:41
: where h1 is there and displays the product name, but in Titley is would I get away with... - Deanna.Mertz commented on July 2nd 19 at 18:44
: 1)why do you need this feature?
2)show how you implement the function and pass data to it - Nathanial_Rath50 commented on July 2nd 19 at 18:47
: no I didn't implement it, I downloaded the engine lazypay (online store) and try each product to configure , in the body it produces excellent, but in the title tag - no. - Deanna.Mertz commented on July 2nd 19 at 18:50
: then create the right question - Nathanial_Rath50 commented on July 2nd 19 at 18:53
we created already... - Deanna.Mertz commented on July 2nd 19 at 18:56
July 2nd 19 at 18:28
f4e8c5869acf475c9afb6d7a9ca0f274.png

Find more questions by tags PHP