Rob's blog

Simple way to output JSON object in PHP

Provided you have PHP 5.2.0 or greater you will have the "json_encode" method.  If, like me however, you dont have version 5.3.0 or greater what you won't have is the second argument to this function - "options".  This allows you to force a particular JSON output style, such as array or object.

I wanted to output a JSON object, but rather than have to instantiate a stdobject and set a load of properties on it you can use PHP's cast construct to just cast an array into an object, like this:

Zend_Locale performance issues

For my current contract at www.workhound.co.uk I am using various elements of the Zend Framework and Doctrine for ORM.  I was experiencing very poor performance on certain pages, all of which had calls to the ORM layer on them which at first led me to think it might be database calls or Doctrine.

PST! Don't tell anyone but consuming web services in PHP just got easy

My current contract required me to write some proxy classes for consuming a web service, they have a number of API's integrated with their application and all of them use nuSOAP - something I have quite a bit of experience with and I know all to well that API integration with nuSOAP involves alot of manual coding to do things like mapping associative arrays of complex SOAP types back into PHP objects.

Security and Permissions

Does anyone else have this problem or is it always just me...?

I worked on a project about 2 years ago in PHP that had a requirement for fairly complex permissions within security roles. The kind of problem I had, and one I am sure is fairly common was as so...

Syndicate content