Re: empty() and method return values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Ashley Sheridan" <ash@xxxxxxxxxxxxxxxxxxxx> wrote in message 
news:1275940320.2248.40.camel@xxxxxxxxxxxx
> On Mon, 2010-06-07 at 22:40 +0300, Tanel Tammik wrote:
>
>> Hi,
>>
>> empty() cannot check the return value of the method or function. which 
>> would
>> be the best workaround?
>>
>> empty($class->method())   // gets an error
>>
>> i could do
>>
>> $method_return_value = $class->method() and then run empty() on
>> $method_return_value or is there an better option? i would like to do it 
>> in
>> if statement....
>>
>> i wrote an class for handling file uploads and there is an method
>> getErrors() which returns empty array in case of 0 errors and i need to
>> check it before i move any files. i'm just curious, what is the right way 
>> to
>> do that!
>>
>> Br
>> Tanel
>>
>>
>>
>
>
> Are you sure this is what is giving you the error, as people are using
> this fine in their examples on the manual page for empty()
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

from the php manual:

Note: empty() only checks variables as anything else will result in a parse 
error. In other words, the following will not work: empty(trim($name)).

Br
Tanel 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux