Upgrade to PHP 5.2 and Get JSON For Free

A few days ago when PHP 5.2 was released one of the things that caught my eye was that it now includes the JSON extension. For anyone doing AJAXy type stuff JSON is an easy way to martial your data between your server side language and javascript.

For the longest time I've been using the older PHP JSON library to do JSON with PHP but now that the extension is included in the core I decided it was time to test it out. I took a couple of minutes and converted my DNSBL checker as a test since it has a fairly large data-set that gets converted and sent back. The json functions provided by the extension are probably easier to use since the JSON library needed you to create an object first but that wasn't a real issue. After making the change I could tell JSON extension was faster than the library. After a little digging I found that someone has done a little extension vs library testing and claims the JSON extension is 153 times as fast as the library.

Tags: ,

This entry was posted in programming and tagged , ,

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>