note 58913 added to ref.array
| From: | stalker at ruun dot de | Date: | Sun, 20 Nov 2005 09:15:59 +0000 |
| Subject: | note 58913 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98845@lists.php.net to get a copy of this message | ||
I had some problems while selecting sub-arrays from multi-dimensional arrays (like the SQL-WHERE
clause), so i wrote the following function:
<?php
function selectMultiArray($__multiarray,$__key,$__value) {
foreach($__multiarray as $multipart) {
if($multipart[$__key] == $__value) {
$__return[] = $multipart;
}
}
if(empty($__return)) {
return FALSE;
}
return $__return;
}
?>
hope someones finding this helpful. If you have better was for getting to this, please answer.
greets,
St4Lk3R
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58913
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58913&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58913&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58913&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58913&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58913&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58913&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58913&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58913&report=yes
Search -- http://master.php.net/manage/user-notes.php