Do I need to update my code every time?

Hi.

As you know PHP is improving and evey time a new version is released but the question, do I need to update my code and change it every time? or that is related to PHP engine not to my code? I want to understand this issue.

You only really need to look over your code when a new major version comes out.

For example, PHP5 and 5.2 specifically got rid of some major downfalls of PHP4, so people have to change their code a little to adjust it to smoother running code.

Generally if you don’t use depricated functionality in PHPx, then your code should work fine in PHPx+1. Deprication is more of a warning - so if you’re using REGISTER_GLOBALS in PHP5 then you’d better be prepared to do some serious code modification in PHP6.

Personally I see a new version of PHP as a chance to make a new better version of existing code, but in a production environment that may not be the most beneficial thing - so production environments are often frozen to the PHP version they were written for.