PHP Discussion

Discussion related to PHP

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.

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;
}

But soon i recover that it is not that perfect, any suggestion.

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.

Cumulus Tag Cloud

Kiran Says

I love work environment which is:

Informal yet professional
Demanding yet rewarding
Challenging yet inspiring
Mediocrity is not an option
Having fun is serious business
Making mistakes is human
Forgiveness is Company Policy

Travelling Sucks