note 38129 added to function.array-intersect
| From: | ben at kazez dot com | Date: | Tue, 09 Dec 2003 15:49:58 +0000 |
| Subject: | note 38129 added to function.array-intersect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61689@lists.php.net to get a copy of this message | ||
To check whether an array $a is a subset of array $b, do the following:
<?php
if(array_unique($b + $a) === $b)
//...
?>
Actually, PHP ought to have a function that does this for you. But the above example works.
----
Manual Page -- http://www.php.net/manual/en/function.array-intersect.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38129
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38129&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38129&report=yes
Search -- http://master.php.net/manage/user-notes.php