Some of these items are things that are new to 5.2, but of interest because 5.3 has modified their implementation. </li></ul>
Backward Incompatible Changes <ul><li>Object._toString() </li><ul><li>used for string casting everywhere, so you can override it, in fact you MUST if you want to use it for any place you may treat an object like a string, like in an echo DEBUG statement. Objects still can't be indices of arrays though, for that you must provide your own unique instance hash or call spl_object_hash(), even if you know it's unique. (Or fake it out with an explicit string cast: $array[(string)$object]) </li></ul><li>realpath() is now fully platform independent. </li></ul>
Deprecations (2) <ul><li>You must now specifically cast objects as an array to use them in the array sort functions. (Do this anyway...)
magic methods __get, __set, __isset, __unset, and __call must always be public and can no longer be static.
The __call magic method is now invoked on access to private and protected methods. (Not just public any more. Self __call) </li></ul>
Deprecations (2) <ul><li>Oracle extension now requires at least Oracle 10. (I think this is a bad idea, too many legacy Oracle installations)
'goto' and 'namespace' are now reserved words. Do a string search in your code. More on these later </li></ul>
New stuff <ul><li>Many new more descriptive error messages, especially with class handling.
Date object moved into the core, and all supporting functions have also become objects. Timezone is inspected more for intervals, etc. </li></ul>
Functions with new optional parameters <ul><li>http://us.php.net/manual/en/migration52.parameters.php
Highlights: </li><ul><li>datetime can now do milliseconds in the format
cookie functions take "httponly" so they can't be accessed by XSS attacks.
xmlreader now lets you set the encoding directly for reading. No more stream encoding manually. </li></ul></ul>
New Functions <ul><li>http://us.php.net/manual/en/migration52.functions.php
Highlights: </li><ul><li>error_get_last - Just get the last error info as an assoc array
Multibyte string handling functions. For you UTF-8 guys. </li></ul></ul>
Use to encapsulate classes and variables to prevent naming collisions on large projects.
Namespaces are declared using the namespace keyword. A file containing a namespace must declare the namespace at the top of the file before any other code - with one exception: the declare keyword. No non-PHP code either, so don't use it with embedded PHP.
Sub-namespace with backslashes: namespace MyProjectSubLevel; </li></ul>
Namespaces (2) <ul><li>Namespaces may be single-line versions:
namespace ThisNamespace; //Continue to end of file or next namespace directive
Use an unnamed function as the parameter for a callback function to keep code readable and not worry about namespace collisions.
Can also assign an anonymous function to a variable and call like "$function($param);"
Anon functions may inherit certain variables from their parent "calling" stack with the "use" operator. </li></ul>
Two new "magic" functions <ul><li>__invoke </li><ul><li>When an object is being called like a function. </li></ul><li>__callStatic </li><ul><li>Like __call but for inaccessible static functions. </li></ul></ul>
NEWDOC String Declaration <ul><li>Like Heredoc, but treated like a single quoted string. No parsing. </li><ul><li>$string=<<'ENDOFSTRING' Blah "costs" $20.00 ENDOFSTRING; </li></ul><li>Heredoc may now be defined with double quotes. I recommend this to increase readability. </li></ul>
Const Declaration <ul><li>You can now use "const" outside of a class as a synonym of "define". </li></ul>