function return true vs return nothing
Posted: Fri Mar 11, 2011 6:23 pm
Is it a good practice that I put in functions that don't return anything return true statement or can be without? I have two example. Is it ok to leave it like that?
Code: Select all
function checkAdminLogin ()
{
if ( empty($_SESSION['administrator']) || $_SESSION['administrator']!=ADMINISTRATOR_PASSWORD) {
header ("Location: /administration/login.php");
}
}
function updateCounter ()
{
global $db;
$db->query("UPDATE users SET counter=counter+1");
}