15 Tips to Optimize Your PHP Script for Better Performance for Developers

1. Use Native PHP Functions
As much as possible, try to use native PHP functions rather than writing your own functions to achieve the objective. For example, you can use range( b, k) to get an array of alphabets starting from b to k in sequence, if it is only needed once in the script rather than declaring an array with these values in a function and returning it on its call.

2. Use Single Quotes
Using single quotes ( ‘ ‘ ) is faster than using double quotes( ” ” ) if you are going to keep only the string inside it avoiding any variables. Double quotes checks for the presence of variable and adds little bit of overhead.

3. Use = = =
Use “= = =” instead of “= =”, as the former strictly checks for a closed range which makes it faster.

4. Use Appropriate Str Functions
str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4.

5. Calculate Only Once
Calculate and assign the value to the variable if that value is getting used numerous time rather than calculating it again and again where it is being used. For example, the following will degrade the performance.

6. Pass Reference to Function
Pass reference to the function if it does not affect your logic. A function manipulating the reference is faster than those manipulating the value been passed as here one more copy of the value is getting created. Especially it adds overhead when the value passed by you is a big array.

7. Create Classes Only When its Required
Don’t create classes and method until and unless its really needed, used and reused as well.

8. Disable Debugging Messages
File operations are expensive. So, if you have written lot of custom functions to log errors and warning during your development process, make sure you remove them before you push the code to production.

9. Use Caching Techniques
Use cache to reduce the load of database operations as well as the script compilation. We can use memcache for the reducing database load and APC for opcode caching and intermediate code optimization.

10. Close the Connection
Get into the habit to unset the variables and close database connection in your PHP code. It saves memory.

11. Reduce Number of Hits to DB
Try to reduce the number of hits to the database. Make queries aggregate so that you call the database less number of times.

12. Frequently Used Switch Cases
Keep most frequently used switch cases on the top.

13. Use Methods in Derived Classes
Methods in derived classes are faster than base classes. For example, let there be a function in both base class and derived class for performing task1. It is named as “forTask1? in base class and “forTask1again” in derived class, so that they will not override.

14. Use JSON
Use JSON instead of XML while working with web services as there are native php function like json_encode( ) and json_decode( ) which are very fast. If you are bound to have XML form of data, then use regular expression to parse it instead of DOM manipulation.

15. Use isset
Use isset( ) where ever possible instead of using count( ), strlen( ), sizeof( ) to check whether the value returned is greater than 0.
SOurce & Credit

15-tips-to-optimize-php-code
25 Things Every Web Designer Needs to Hear
25 Things Every Web Designer Needs to Hear

We all hit road blocks sometimes. That’s why you got to have a stack of good quotes that will help you remember why you started what you are working on in the first place. Here are some inspiring and hilarious quotations from amazing designers that are sure to help any productivity or inspiration block!

Web Design
Responsive Web Design

Unless you’re totally new to the industry, or you’ve been living under a rock in the faraway lands of another planet, you’ll have heard about responsive design. Even if you don’t understand it fully, it’s bound to be something you’ll have come across or interacted with in some way or another.

The Unquestionable Importance of Website Security in 2016
The Unquestionable Importance of Website Security in 2016

2015 was the year of the hack. More DDoS attacks, data breaches and hacking incidents than the online world had ever seen before. Add to these the nude celebrity photos scandal and an international cyber sabotage episode involving a major Hollywood film studio, and you’ll soon realise why hacking received a lot of media attention last year.And that’s just the breaches that were tracked! Who knows how many other security problems went unreported or, more worryingly, undetected?

SEO Company Mauritius
100 SEO Tips For Small Businesses

No SEO means no visitors from search engines. If you don’t do it then search engines can’t categorise and rank your site for keywords relevant to your business.