note 47000 added to control-structures.else

From: Date: Sat, 30 Oct 2004 04:32:45 +0000
Subject: note 47000 added to control-structures.else
Groups: php.notes 
Request: Send a blank email to php-notes+get-79341@lists.php.net to get a copy of this message
me, being a c/c++ programer, would be lazy and try to type as few characters as possible so that last statement: echo "You have $i ". ($i==1 ? "message" : "messages"). " in your mailbox.\n"; can become: echo "You have $i message".($i-1?"s":"")." in your mailbox.\n"; since if $i is 1 it ($i-1) would result in a 0 and evaluate as false. But if $i is more than 1 will be a positive integer and evaluate as true and add the 's'. ---- Manual Page -- http://www.php.net/manual/en/control-structures.else.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47000 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47000&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47000&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47000&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47000&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47000&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47000&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47000&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79341) next »