:
ANDing PHP , JavaScript, , :
<?php
$object = new stdClass;
$object->field = 10;
$param = new stdClass;
$param->object = $object;
$field = !($param && $param->object)?: $param->object->field;
echo $field,"\n";
$field = get_object_vars( $param->object )["field"] ?? null;
echo $field,"\n";
"Elvis" "?:" $, . , $ param , $param->, NOT ("!"), .
You can also perform the task of obtaining field data without ANDing using the get_object_vars()"??" operator in PHP 7 in tandem with get_object_vars().
source
share