📜  从空值创建默认对象 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:51.600000             🧑  作者: Mango

代码示例2
// This message has been E_STRICT for PHP <= 5.3. Since PHP 5.4, it was unluckilly changed to E_WARNING. Since E_WARNING messages are useful, you don't want to disable them completely.
// To get rid of this warning, you must use this code:

if (!isset($res)) 
    $res = new stdClass();

$res->success = false;

// this code is from @TMS' answer on the source