From php-general Tue Nov 04 12:54:58 2014 From: Dotan Cohen Date: Tue, 04 Nov 2014 12:54:58 +0000 To: php-general Subject: [PHP] Re: Redundant isset() check? Message-Id: X-MARC-Message: https://marc.info/?l=php-general&m=141510572307656 On Tue, Nov 4, 2014 at 2:37 PM, Christoph Becker wrote: > Then you might consider using the following: > > $index = isset($_SERVER['DOCUMENT_ROOT']) > ? $_SERVER['DOCUMENT_ROOT'] : 0; > do_something_with($connection_details[$index]); > > BTW: after upgrading to PHP 7 you could use the null coalesce operator[1]: > > $index = $_SERVER['DOCUMENT_ROOT'] ?? 0; > > [1] > Thank you. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php