close
<?php
function get_subjects($obj_name)
{
if(!is_object($obj_name))
{
return(false);
}
return($obj_name->subjects);
}
$obj_name = new stdClass;
$obj_name->subjects = Array('Physics', 'Chemistry', 'Mathematics');
var_dump(get_subjects(NULL));
var_dump(get_subjects($obj_name));
?>
輸出 :
bool(false) array(3) { [0]=> string(7) "Physics" [1]=> string(9) "Chemistry" [2]=> string(11) "Mathematics" }
全站熱搜
留言列表