note 57799 deleted from function.array-keys by nlopess
| From: | nlopess@php.net | Date: | Sun, 23 Oct 2005 10:17:38 +0000 |
| Subject: | note 57799 deleted from function.array-keys by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97447@lists.php.net to get a copy of this message | ||
Note Submitter: saddor at gmail dot com
----
hello people this is my first time here, i am 18 years... i am so exited!!! i am from Paraguay..
and i wrote this funcion, if someone knows if php brings a compiled funcion similar to this please
write to me... (sorry 4 my english i am learning it)
this is a funcion which search in array
<?
function search_array($array,$word)
{
/*
Made in Paraguay!!!
Please visit my website
www.saddor.com
thank u!!!
*/
$i=array();
if (!is_array($array)) return false;
foreach ($array as $key=>$value)
{
if (stristr($value,$word))
{
$i[]=$key;
}
}
/*
I am a C/C++ programmer and i dont
know if is right what i am doing belong this
comment, what i am trying to do is free
memory.. please write me if it will do
my code more faster
*/
unset($array);
unset($key);
unset($value);
return $i;
}
/*
Some example
*/
$a[2]="cesar rodas";
$a[4]="saddor";
$a[6]="rodas cesar";
$a[15]="saddor.com rodas saddor.com";
print_r (search_array($a,"rodas"));
print "<br>";
exit;
?>
This script will output something sililar to this:
Array ( [0] => 2 [1] => 6 [2] => 15 )
whatever thing write tome to saddor@gmail.com