Answers for "optional chain operator php"

PHP
0

optional chain operator php

Optional chaining is not supported in php ( ?. operator )
But you can use something like this

if ($a && $a->$b && $a->$b->$c) {
  $d = $a->$b->$c;
}

$d = $a?->$b?->$c;
// assigns null to $d upon failure
Posted by: Guest on October-12-2020

Browse Popular Code Answers by Language