Req #21942 [Opn->Csd]: array_intersect with empty in IF statement
| From: | nikic@php.net | Date: | Wed, 20 Jun 2012 19:14:00 +0000 |
| Subject: | Req #21942 [Opn->Csd]: array_intersect with empty in IF statement | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171396@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=21942&edit=1
ID: 21942
Updated by: nikic@php.net
Reported by: verx at implix dot com
Summary: array_intersect with empty in IF statement
-Status: Open
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Linux 2.4
PHP Version: 4.3.0
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Using empty() on function call results will be possible in PHP 5.5. For more info see https://wiki.php.net/rfc/empty_isset_exprs.
Previous Comments:
------------------------------------------------------------------------
[2003-01-30 08:45:17] hholzgra@php.net
Feature Request: have a meaningful (not to 'us' but to 'them') error message
here ...
------------------------------------------------------------------------
[2003-01-29 08:00:31] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
read the docs @ php.net/empty again.
------------------------------------------------------------------------
[2003-01-29 07:59:20] verx at implix dot com
$array1 = array ("a" => "green", "red", "blue");
$array2 = array ("b" => "green", "yellow", "red");
if (false == empty(array_intersect ($array1, $array2)))
{
echo 1;
}
Log output:
PHP Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or '$' in
/var/www/test/arint.php on line 6
line 6 is the line with IF statement.
However the following code works perfectly:
$array1 = array ("a" => "green", "red", "blue");
$array2 = array ("b" => "green", "yellow", "red");
$result = array_intersect ($array1, $array2);
if (false == empty($result))
{
echo 1;
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=21942&edit=1