Could you please explain what does the operator ?->
do in PHP, since I have this piece of code:
$drive = $objDrive?->func?->getDriver()?->value;
Could you please explain what does the operator ?->
do in PHP, since I have this piece of code:
$drive = $objDrive?->func?->getDriver()?->value;
For the moment, it's just a proposal, you can find it enter link description here. It's the NullSafe Operator
, it returns null
in case you try to invoke functions or get values from null
... Example
$objDrive = null;
$drive = $objDrive?->func?->getDriver()?->value; //return null
$drive = $objDrive->func->getDriver()->value; // Error: Trying to get property 'func' of non-object