Helpful Tips and Tricks

jQuery validation : End date should be Greater than Start date

In some case when you are working around dates you need to validate two dates. For e.g if you are working with Start Date and End date than "End Date must be Greater than Start Date". This can be done by javascript by comparing two dates. But if you are using jquery validation than below is the easy and simple way to check that End date is Greater than Start Date or not.

How to remove index.php from url using .htaccess (mod_rewrite)

For better SEO optimization and make urls more search engine friendly , remove index.php from URL and make it easier to read. This can be done by writing only two lines in your .htaccess(mod_rewrite in apache) file. Before writing this rule in .htaccess , make sure that your mod_rewrite is enabled(On) in your apache server.

How to redirect www to non-www and non-www to www URL using .htaccess redirect(mod_rewrite)

Websites can be access with www and without www also. Since Search engines consider http://www.programmingfacts.com and http://programmingfacts.com different websites. It might be a case of duplicate content. So you must stick your domain name accessible either with www or without www.

Merging Arrays with Reindex and without Reindexing

All we know about array_merge(param1,param2) array function in PHP. It may be possible that some begineers didn't come across this function. For those people, array_merge(param1,param2) will merge two arrays and reindex all elements in array. But there are some cases in which you need to keep the same indexes(preserve numeric keys) of this arrays..

Solved – Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent

This is the most common error, you will face when you will start working with sessions in PHP. I got below error. "Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent" and i got success to solve this. So i would like to share this with all of you.

The Ternary Operator – Working same as If-Else

We know, in programming there are three operators named Unary Operator , Binary Operator and Ternary Operator. Operator’s name itself says that if it is a Unary Operator(e.g. Increment – Decrement operators) than it will take only one operand, If it is Binary operator(e.g. Relational operators) than it will take two operands and if it is Ternary operator than it will take three operands.

Speed up Performance of Loop with Large Arrays

As we know, FOR loop is same for all programming language, it does not matter , in which language you are working. This is about how to decrease load time. I have shown an example of PHP language. Generallly we are using the FOR loop as below which count a $large_array every time the FOR loop execute.