PHP casting an object to an array

This just cost me a day. I had a JSON structure that I wanted in an array.
   "10": {
      "foo": "bar"
   "20": {
      "baz": "fup"
So the easiest way to do this (I thought) would be:
$content = (array)json_decode($some_json)
but I could not access any array element event though I could clearly see that the key existed
PHP Notice:  Undefined offset: ...
After slowly going insane I found a stackoverflow post that pointed to this
If an object is converted to an array, the result is an array whose elements are the object's properties. The keys are the member variable names, with a few notable exceptions: integer properties are unaccessible; private variables have the class name prepended to the variable name; protected variables have a '*' prepended to the variable name. These prepended values have null bytes on either side. This can result in some unexpected behaviour:

This is fucking insane. Who comes up with this shit!?

Your rating: None Average: 5 (7 votes)

Guilty as charged

Your rating: None Average: 4.9 (11 votes)

PHP static late binding

I just stumbled across this myself and am glad that I am not crazy after all ...

PHP case sensitivity @#&^%!

The other day I finally figured out why some people are so violently opposed to PHP. When using object oriented features of PHP5 I discovered the hard way that PHP has some weird, backwards compatibility issue rules how it handles case.

In a nutshell, variables are case sensitive, but function names, and object methods (!!!) are not.

That explains why the following code does not work

class A {
GET($url) {
// retrieve the url
B extends A {
private var

get($var) {

Your rating: None Average: 1.5 (2 votes)

NGINX + PHP-FPM + APC = Awesome

Trawling the internet for solutions that combine APC with memcache I came across this article. It talkes about NGNIX and APC, one of my next frontiers (ngnix) anyways, so I decided to "bookmark" it here.

What if there was no IE6?

Recently I have been fighting IE6 again, and it never stops to amaze me how it can ruin my day. So I thought I link to this article/blog on which speaks to this piece of $#@%!$@ software.

Hybridizing Java

A very thoughtful 'article' by Bruce Eckel about the state of affairs of 'the Web'


FireBug lets you explore the far corners of the DOM by keyboard or mouse. All of the tools you need to poke, prod, and monitor your JavaScript, CSS, HTML and Ajax are brought together into one seamless experience, including a debugger, an error console, command line, and a variety of fun inspectors.

Syndicate content