note 118418 deleted from function.empty by cmb
| From: | cmb@php.net | Date: | Wed, 16 Dec 2015 16:48:12 +0000 |
| Subject: | note 118418 deleted from function.empty by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204447@lists.php.net to get a copy of this message | ||
Note Submitter: lordgiotto at gmail dot com
----
Pay attention if you want to use empty() with a returned value of a function!
empty() accepts only a variable, so you CAN'T DO THIS (the web server could return a 500
internal error):
<?php
emtpy( function_that_return_a_value() ); // DON'T DO THAT
?>
Insteed you HAVE TO ASSIGN THE RETURNED VALUE TO A VARIABLE and then CHECK THE VARIABLE:
<?php
$returned_value = function_that_return_a_value();
empty( $returned_value ); //DO THAT INSTEED
?>