Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

πŸš— You set the rental price
πŸ” Secure bookings with verified renters
πŸ“ Track your vehicle with GPS integration
πŸ’° Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

PHP Laravel Error: Trying to access array offset on value of type null

Environment:
Laravel Version: 5.5
PHP Version: 7.4.0

Error stack trace:
Message: Trying to access array offset on value of type null

Sample code that gave me error:
$filterConfig = $request->get('filterConfig', null);
$showAll = $filterConfig['show']['all'] === 'true'? true: false;

The error was coming because $filterConfig was getting initialized by null in the first line and I was fetching $filterConfig[‘show’][‘all’] in the second line. Hence, it was throwing an error by saying Trying to access array offset on value of type null

NOTE: This error only comes if you have upgraded to PHP 7.4

Solution:

if (isset($filterConfig) && isset($filterConfig['show']['all'])) {
$showAll = true;
} else {
$showAll = false;
}

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.