[wd_asp elements=’search’ ratio=’100%’ id=1]

Exclude from array – (in array) – Php

15th August 2014

Php - Arrays

php codehaven


$result = mysql_query("SHOW DATABASES");
while($row = mysql_fetch_array($result))
{
$mydb = $row['Database'];
$unwanted_db = array('information_schema','performance_schema','mysql','alpha','boots');
if (in_array($mydb, $unwanted_db))
{
echo "Found";
}
else
{
$mydatabases[]= $mydb; // add to new array
}
}//end while

Or not in array