note 118418 added to function.empty

From: Date: Thu, 03 Dec 2015 10:58:59 +0000
Subject: note 118418 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-204267@lists.php.net to get a copy of this message
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 ?> ---- Server IP: 72.52.91.14 Probable Submitter: 217.221.64.18 ---- Manual Page -- http://php.net/manual/en/function.empty.php Edit -- https://master.php.net/note/edit/118418 Del: integrated -- https://master.php.net/note/delete/118418/integrated Del: useless -- https://master.php.net/note/delete/118418/useless Del: bad code -- https://master.php.net/note/delete/118418/bad+code Del: spam -- https://master.php.net/note/delete/118418/spam Del: non-english -- https://master.php.net/note/delete/118418/non-english Del: in docs -- https://master.php.net/note/delete/118418/in+docs Del: other reasons-- https://master.php.net/note/delete/118418 Reject -- https://master.php.net/note/reject/118418 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204267) next »