Re: How to Use Array's efficiently in PHP Hi sabari,
Its ok, but ive made one small change in your code. It is checking only case sensitive in array...
so i have changed just one function : ereg to eregi. Now its working case insensitive.
$vSearchStr = "hi";
$Array = array("hello","hi mathew");
$Search=array();
foreach($Array as $key => $value)
{
if(eregi($vSearchStr,$value))
{
$Search[$key]=$value;
}
}
print_r($key); |