1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$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
1 2 3 4 5 6 7 8 9 10 11 |
<?php $string = 'a'; $array = array( 'b', 'c', 'd' ); if ( ! in_array( $string, $array ) ) { echo "These are not in array"; // not in array } ?> |