'How to fetch value from stdObject array in php? [duplicate]

I have one array which is a type of stdClass object i want to fetch the message key value from that array based on that one i have t perform my logic please help me to acheive this thing

$temp = (object) [array('message'=>'my dummy text')];
$search_value = json_decode(json_encode($temp->message,true),true);
if(str_contains('my dummy text',$search_value)){
  //my logic
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source