// Pointless commenting example: // ---------- $username = mysql_real_escape_string($_POST['username']); # Get username $password = mysql_real_escape_string($_POST['password']); # Get password $age = intval($_POST['age')]; #Get age // ---------- // The above is useless because it's quite obvious of what's happening. // Useful commenting: // ---------- # Get information from POST $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $age = intval($_POST['age')]; // ---------- // This way saves time. // Also, a good place to put comments, is when you're making a new function or class. // Describe the inputs and outputs a bit. // ---------- /* Function: salt_crypt Desc: Encrypts a string using a salt. Inputs: $string (string): The string to be encrypted $salt (string) : The salt to use. */ function salt_crypt($string, $salt) { $return = md5(md5($string) . $salt); return($return); } // ---------- /* Why comment like that at the beginning of a function? It will save a lot of time. Saves the person reading from having to go through the code for that function. */