RE: alternative to empty

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

 



May be you can try (string)$string or (int)$string (seemed a little
strange).
Any way Ross, we need to see ur code to determine your problem.

 
 
 
Best regards,
Shiqi Yang
-----Original Message-----
From: Philip Hallstrom [mailto:php@xxxxxxxxxxxxxxx] 
Sent: Thursday, July 07, 2005 12:15 AM
To: Dan Rossi
Cc: Ross; php-general@xxxxxxxxxxxxx
Subject: Re:  alternative to empty

>> I have been using empty in forms for some time now. but have just 
>> discovered
>> that
>> 
>>       PHP 4 As of PHP 4, The string value "0" is considered empty.
>
> If ($string == '') ??

Careful... notice the differenec b/n == and ===....

<?php
   $s = 0;
   if ($s == '') {
     print("==\n");
   }

   if ($s === '') {
     print("===\n");
   }
?>

% php foo.php
==
%

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

-- 
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