Skip to content

Latest commit

 

History

History
12 lines (10 loc) · 266 Bytes

optional.md

File metadata and controls

12 lines (10 loc) · 266 Bytes

optional()

Provide access to optional objects.

optional()

$nullObj = null;
// Fatal error
$nullObj->method();  // Call to a member function method() on null
// Using the optional function prevent this error
optional($nullObj)->method(); // null