function show_movies_rate($db, $argv) { if (verif_float($argv[3])) { $num = intval($argv[3]); $collection = $db->createCollection("movies"); $range = array('$gte' => (double) $argv[3], '$lte' => (double) $argv[3] + 0.9); $cursor = $collection->find(array('rate' => $range)); $i = 0; foreach ($cursor as $film) { echo_movie($film); $i++; } if ($i == 0) { echo "[33mSorry, no movie found.[0m\n"; } else { echo "*" . $i . "*\n"; } } else { echo "[31mError: Must be an int between 0 and 10.[0m\n"; } }
function show_movies_rate($db, $argv) { if (verif_float($argv[3])) { $num = intval($argv[3]); $collection = $db->createCollection("movies"); $range = array('$gte' => (double) $argv[3], '$lte' => (double) $argv[3] + 0.9); $cursor = $collection->find(array('rate' => $range)); $i = 0; foreach ($cursor as $film) { echo_movie($film); $i++; } if ($i == 0) { echo "Sorry, there is no film according to your research.\n"; } else { echo "*" . $i . "*\n"; } } else { echo "Error: Must be an int between 0 and 10.\n"; } }