开发者

how to remove notice error from this code without using @-operator?

I want to remove the notice error? how can i remove it without using the @-operator?

if($result->CreateResult->RateAccessorials->RateAccessorialItem!=null

Error:

Error:Notice: Undefined property: stdClass::$RateAccesso开发者_StackOverflowrialItem in /some/path/SaiaSecure.php on line 333


PHP's isset construct does exactly this.

if(isset($result->CreateResult->RateAccessorials->RateAccessorialItem)){
  // ...
}

The above code presumes two conditions for correct operation:

  • That $result->CreateResult->RateAccessorials is always set
  • That $result->CreateResult->RateAccessorials is always an object

Edit: I've answered for the sake of question. As a StackOverflow user, it is your duty to select an answer and mark it as such.


In php Checking value is set or not.Use isset function in php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜