A "no frills" listing of all the databases present can be obtained by means of the simple following steps:
<?php
$conn = new MongoClient("mongodb://localhost");
$dbases = $conn->listDBs();
$num = 0;
foreach ($dbases['databases'] as $dbs) {
$num++;
$dbname = $dbs['name'];
echo "<br> $num. $dbname";
}
?>
On the assumption that you have three databases present, the foregoing will produce an output that will look similar to this:
1. local
2. members
3. test