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)

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)

views as CCK node reference filters

Drupal's CCK module supports views to filter the nodes to offer for the node reference field type.

The view can be specified with an argument, but the argument is static to the CCK field definition.

With the following snippet of code in the view arguments code, one can specify something dynamic, in my case part of the URL.

Your rating: None Average: 2.8 (20 votes)


I wasted several hours today trying to enable behaviors in a Drupal 5 site and just couldn't get it to work. Several other sites on the same server had it working. All the instructions I found on the web were straight forward and correlated with what I am doing.

Finally I figured out that core drupal 5 does not have behavior functionality. The jstools module implements this feature, since everything magically worked as soon as I enabled that module.

No votes yet

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.


This is a simple php script which allow you to upload and download files. There isn't any complex user management because it aims more for private file repository use.

It as direct file deletion using AJAX, instant table sort using a self modified version of sorttable.js and finally upload file progressbar using a cgi(perl) script.

If you want to know more about those technologies, go to more information section.

zephyr - an ajax based framework for php5 developers

zephyr is an ajax based framework for php5 developers. you can easily develop business applications using this robust framework. this is extremely easy to learn and very simple to implement. you can deliver a full fledged ajax application with strong business layer in backend within some minutes. installation and deployment of packages that you develop for zephyr is hassle free. moreover you will get all the features of most popular templating engine "smarty" and powerfull data access layer "adoDB". lets go through the documentation process to discover how easy is to develop an ajax applicatio

Syndicate content