Develop Rock-Solid Code In PHP: Lay The Foundation, Part 1
By Amol Hatwar
2004-01-21
Reader Rating:

Make it platform-independent
Another issue that you must address is platform-independence. Of course, scripts written for PHP on Windows will work on PHP on any other platform: PHP is designed that way. However, you still need to take care of minor inconsistencies. The new line character, for instance, is represented differently in Windows and UNIX.
You must also use abstraction when accessing resources like databases that are external to PHP. Say your application uses MySQL as a database server to cut costs. If you decide to have a more feature-rich database later, you will have to change the code in your application. Making massive changes to code is always a drudgery and an error-prone process. Using abstraction isolates changes to parts that can be easily changed. You do not have to redo the entire application.
Ensure that you write platform-independent code. It makes your application more adaptable and scalable.
First published by IBM developerWorks
If you found this article interesting, you may want to read these as well:
» Protecting your PHP and HTML Source Code
» Publishing Newsletters Using PHP & MySQL - 4
» Publishing Newsletters Using PHP & MySQL - 3
» Publishing Newsletter Using PHP & MySQL - 2
» Publishing Newsletters Using PHP & MySQL
» Unix Webserver Crontab Basics
|