note 108665 added to control-structures.if
| From: | cjnimes at yahoo dot com dot ar | Date: | Wed, 16 May 2012 02:10:23 +0000 |
| Subject: | note 108665 added to control-structures.if | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188003@lists.php.net to get a copy of this message | ||
@marcin_wo_wroc:
A much simpler and cleaner way to do that (one else for two ifs) is simply separate the conditions
with an "AND" operator:
<?php
if ( is_object($times) && (float)$times->getTime()>0 ) {
// ...
} else {
// ...
}
?>
----
Server IP: 201.216.232.3
Probable Submitter: 186.142.67.133
----
Manual Page -- http://www.php.net/manual/en/control-structures.if.php
Edit -- https://master.php.net/note/edit/108665
Del: integrated -- https://master.php.net/note/delete/108665/integrated
Del: useless -- https://master.php.net/note/delete/108665/useless
Del: bad code -- https://master.php.net/note/delete/108665/bad+code
Del: spam -- https://master.php.net/note/delete/108665/spam
Del: non-english -- https://master.php.net/note/delete/108665/non-english
Del: in docs -- https://master.php.net/note/delete/108665/in+docs
Del: other reasons-- https://master.php.net/note/delete/108665
Reject -- https://master.php.net/note/reject/108665
Search -- https://master.php.net/manage/user-notes.php