How to avoid MissingPropertyException

前端 未结 2 1492
无人及你
无人及你 2021-01-04 09:29

If an object does not have a property and I am accessing the property, we get a MissingPropertyException. Can I do something similar to safe null (?.

2条回答
  •  抹茶落季
    2021-01-04 10:31

    You can also use try/catch

    try
    {   env.GERRIT_TOPIC=GERRIT_TOPIC
    }
    catch (e_val)
    {   echo 'missing GERRIT_TOPIC'
    }
    

提交回复
热议问题