note 81593 added to function.in-array
| From: | sick949 at hotmail dot com | Date: | Wed, 05 Mar 2008 11:43:05 +0000 |
| Subject: | note 81593 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136759@lists.php.net to get a copy of this message | ||
A first idea for a function that checks if a text is in a specific column of an array.
It does not use in_array function because it doesn't check via columns.
Its a test, could be much better. Do not use it without test.
<?php
function in_array_column($text, $column, $array)
{
if (!empty($array) && is_array($array))
{
for ($i=0; $i < count($array); $i++)
{
if ($array[$i][$column]==$text || strcmp($array[$i][$column],$text)==0) return true;
}
}
return false;
}
?>
----
Server IP: 80.64.47.13
Probable Submitter: 89.107.243.1
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/81593
Del: integrated -- https://master.php.net/note/delete/81593/integrated
Del: useless -- https://master.php.net/note/delete/81593/useless
Del: bad code -- https://master.php.net/note/delete/81593/bad+code
Del: spam -- https://master.php.net/note/delete/81593/spam
Del: non-english -- https://master.php.net/note/delete/81593/non-english
Del: in docs -- https://master.php.net/note/delete/81593/in+docs
Del: other reasons-- https://master.php.net/note/delete/81593
Reject -- https://master.php.net/note/reject/81593
Search -- https://master.php.net/manage/user-notes.php