My PHP Tips
None related to Zend PHP 5 Certification Blog! This post is just a few pointers by myself that I have learnt in my many years in coding crap.
Plan before you code! (SDLC)
Depends how you want to do this, if its a small project I think about the end user, what they need. Then write the database structure to fit the project. Ensuring I minimise extra data and so forth. Personally a great planning method for me! but when your coding for paying client remember to use the Systems Development Life Cycle (Plan, Research, Design, Build, Test, Fix Bugs) Their are many benefits two of the most important is meeting client requirements and quality assurance.
Clean Code: Search your Code for Functions
When I first started coding it was basic lots of repetition, then I found functions and loved them. Stick some variables in and get some other stuff out, Fabulous!
Recently I ran my functions names trough a search of the scripts folders and found that some functions are only used in one place! … If that is the case remove the function and use progressive code! No need to Bulk up your functions files, complicate and increase run time.
Searching functions also help me split/organise function files and only include them where needed.
40 Tips for Optimizing PHP
Not going to copy them all here, but this is a good read. Some things are obvious such as closing all database questions while others ($row[’id’] is 7 times faster than $row[id]) are just great tips!.
No Comments »
RSS feed for comments on this post. TrackBack URL











