Tag Archives: 5.3

My personal favorites in PHP 5.3

Just in case you’ve been living on Pluto for the past few days : PHP 5.3 was released today.

My personal favorite new stuff and changes :

  • Nested exceptions : something I’ve wanted for a long time !
  • Namespaces : yes, we finally have them ! Now let’s use them properly (this means : use them were needed, but don’t make everything into a namespace !)
  • str_getcsv function : a useful function if you need to import CSV data that’s not stored in a file
  • SOAP user specified headers : very useful if you have some kind of special authentication needs, session or cookie that need to be set, etc. in your SOAP calls
  • PHAR included by default
  • CURLOPT_PROGRESSFUNCTION : very useful if you’re requesting large URLs… combine it with a nice ajax system and you can provide your customers with a neat progress bar
  • Call-time pass-by-reference is deprecated : good… no more reference abuse there… most people using it don’t know what they’re doing, which leads to all sorts of ‘weird’ situations anway

My least favorite :

  • Goto : I know there’s some cases where it might be useful, but honestly it reminds me of my BBC BASIC days… I’m glad there’s no explicit line numbers in PHP 😉
  • Short ternary notation : maybe it’s easier to parse (haven’t looked at the code yet), but I don’t think it’s easier to understand, especially for novices… it’s easy for them to get lost with some of these short notations…
  • mysql_db_query is deprecated : yes, I know there are better ways of handling multiple db’s, but sometimes it’s just so easy to get data from one db and insert it in another one without the need for 2 separate links…
  • __DIR__ global constant : seriously, is dirname(__FILE__) so hard that we need a separate global constant for it ? Then again, it’s better than someone not using globals and calling dirname(__FILE__) 50 times…
  • The mode parameter on round : might be useful, except that the manual doesn’t explain what each option does

But, regardless of these few things, it’s yet another step – no, let me rephrase that – milestone in the right direction.

To everyone who worked on PHP 5.3 : great job ! Keep up the good work !