Thursday, December 2, 2010

PHP MySQL Software Programming Tips

Learning has been simplified with lots of learning tools available and most popular of all is Internet where a user can not only learn but also can surfer as per ones need and can find related stuff, immense flexibility! Online learning is fast, cheaper and offers wider range making Internet the ultimate place to learn.
Coming to PHP mySQL programming for beginners; you can find lots of PHP free e-books online. PHP/MySQL Programming for the Absolute Beginner by Andy Harris is one of the many available.

Gradually you will acquire programming skills that is necessary for practical programming applications and will also learn how these software skills can be put to use in real world scenarios and apply them to the next programming language you tackle.

First of all you need to become familiar with PHP environment, then set of functions, variables, arrays, loops. PHP is closely related to HTML and tied to MySQL database for connectivity. PHP is used today for developing many web applications, also used in many scripts and web projects; I have already discussed in my previous post salient features of PHP.

PHP Tips to Improve Your Programming:

  • SQL injection cheat sheet: Follow the best practices mentioned in the SQL injection (security exploit) sheet to avoid scripting attacks.

  • PHP’s List of Comparison Operators: PHP Programmers should be very well familiar with use of PHP comparison operators.

  • Follow Shortcuts to improve speed and performance: This can be achieved by making code simpler and smaller.

  • Follow a control structure that by dropping a brackets in single expression wherever possible. Learning a language will lead to achieve the same result in several ways.

  • Favour str_replace() over ereg_replace() and preg_replace(): When using regular expression use of ereg_replace() and preg_replace() is preferred as it is much faster than str_replace().str_replace()11 is much more efficient (61% more) than regular expressions at replacing strings .

  • Use of ternary operator frees up line space and makes your code less cluttered, making it easier to scan.

  • Use Memcached for efficient database caching.

  • Use PHP framework like cakePHP to reduce time spent to develop a website.

  • Use the error suppression operator correctly.

  • Switching isset for strlen makes calls about five times faster.


Irrespective of the platform you are working php knowledge has become must-know for all developers. PHP developers should learn and use every time they program the techniques listed above. These tips will speed up not only a developer’s proficiency but also make the code much more responsive, cleaner and more optimized for performance. Good Luck!


So, I am sure beginners are ready to ready to roll up their sleeves and get their hands dirty with the language.

1 comment:

Unknown said...

Went through the tips you have shared, good ones. Also, I would like to say about the new software development approach and methodology that is in boom...agile methodology, agile and lean application development is truly providing agility to software developers along with process governance capabilities. Process governance help organizations define, publish and effectively use a variety of software processes in an agile, flexible and consistent manner.