Discussion related to PHP
Submitted by Kiran on Wed, 08/12/2009 - 12:38
Decrementing Days in PHP
Suppose I have a date coming in, "2009-01-01", what is the correct ways to decrement the date so that it will be just one day smaller.
»
- 2 comments
- 593 reads
Submitted by Kiran on Sun, 02/15/2009 - 11:10
Email validation regex and Function
This has always been my favorite function to validate email address at server side:
function validate_email($email) {
$result = TRUE;
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
$result = FALSE;
}
return $result;
}
$result = TRUE;
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
$result = FALSE;
}
return $result;
}
But soon i recover that it is not that perfect, any suggestion.
»
- 4 comments
- 1242 reads
Submitted by Kiran on Tue, 02/03/2009 - 16:12
Domain Validation
I have this regex -- /^([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/ which is not that effective.
Did any guy have a good tested regex for validating domain name.
»
- 3 comments
- 609 reads













