Wednesday, January 26, 2011

PHP5.2.14 to PHP5.3.5 initial impressions on migration

I had been optimistic that my codes way back from PHP4.3 can do well with my the new version PHP5.3.5 after my codes had undergone migration to PHP5 standards.

I decided to use PHP5.3.5 after its announcement that PHP5.2 reaches its EOL (end of life) -- meaning, there's no more effort in maintaining it -- so the only path is to go with the 5.3 series.

My initial readings had lead me to some of the important issues for the migration: specifically on the backward incompatible changes.

I had paid less attention to the differences on PHP5. But just migrating to the new version changed all that.

A brief rundown of the issues I begin to love on the new one:

1. "strrpos() and strripos() now use the entire string as a needle" - this allows faster and better determination of the existence of a string instead of using strstr() and stristr()

2. normalization of path on Windows when using include_once() and require_once() "so that including A.php and a.php include the file just once".

3. array_replace() and array_replace_recursive() - replaces elements from passed arrays into one array. This should have been #1 on my list. Most of my functions and methods can now accept array parameters that act as triggers and options to return values. They must, however, have default values.

4. "gethostname() - Return the current host name for the local machine". Great use in adding info to the log

5. "date_add() - Adds an amount of days, months, years,hours, minutes and seconds to a DateTime object" and the DateTime class and its methods... I have to upgrade a lot of these.

Well, this is an initial list.. I may have to scour the whole repository for codes that needed upgrading and migration.

Good luck to me!



No comments:

Post a Comment