PHP resource data type: complex structures