This code is part of a websocket server:
$msgArray = json_decode($msg);
if ($msgArray->sciID) {
echo "Has sciID";
}
It will either be receiving a json string like {"sciID":67812343}
or a completely different json string with no sciID such as {"something":"else"}
.
When the server receives the later, it echos out: Notice: Undefined property: stdClass::$sciID in /path/to/file.php on line 10
What is the correct code to check if $msgArray->sciID
exists?