note 110784 added to language.operators.logical

From: Date: Fri, 07 Dec 2012 15:06:42 +0000
Subject: note 110784 added to language.operators.logical
Groups: php.notes 
Request: Send a blank email to php-notes+get-192385@lists.php.net to get a copy of this message
This works similar to javascripts short-curcuit assignments and setting defaults. (e.g. var a = getParm() || 'a default';) <?php ($a = $_GET['var']) || ($a = 'a default'); ?> $a gets assigned $_GET['var'] if there's anything in it or it will fallback to 'a default' Parentheses are required, otherwise you'll end up with $a being a boolean. ---- Server IP: 69.147.83.199 Probable Submitter: 72.52.91.2 (proxied: 50.47.38.2) ---- Manual Page -- http://php.net/manual/en/language.operators.logical.php Edit -- https://master.php.net/note/edit/110784 Del: integrated -- https://master.php.net/note/delete/110784/integrated Del: useless -- https://master.php.net/note/delete/110784/useless Del: bad code -- https://master.php.net/note/delete/110784/bad+code Del: spam -- https://master.php.net/note/delete/110784/spam Del: non-english -- https://master.php.net/note/delete/110784/non-english Del: in docs -- https://master.php.net/note/delete/110784/in+docs Del: other reasons-- https://master.php.net/note/delete/110784 Reject -- https://master.php.net/note/reject/110784 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#192385) next »