February 3, 2008
ArrayAccess interface is an excellent offer from PHP. Though I do not personally like the idea of operator overloading, this interface can be a great tool for developing application faster and neatly by overloading the array access.
The interface is to be implemented by a class and override the accessors methods.

I am giving a simple code that demonstrate its usage.
class MyArray implements ArrayAccess {
private $arr = array();
function offsetExists($name) {
return isset($name);
}
function offsetGet($name) {
return $arr[$name];
}
function offsetSet($key, $val) {
$arr[$key]=$val;
}
function offsetUnset($name) {
unset($arr[$name]);
}
}
$arr = new MyArray();
$userMap["Hello"]="Worlds";
echo $userMap["Hello"];
This class can use a database for its model. The interface facilitates coding array style with similar __get() __set() functionalities for classes.
Btw, anybody knows how I can show codes like code in an editor with line number ?
1 Comment |
PHP | Tagged: Array Operator overloading in PHP, ArrayAccess |
Permalink
Posted by Aman
February 2, 2008
Eventually I have got some free time to relax and to learn. Fortunately this time also turned to a time to earn some
After a long time I worked as free lancer for a week. My brother from US gave me subcontract. The project was mainly to localize Fedex international website as well as build a system for future purpose.
I enjoyed working with ASP.net after about 4 years. Being a java programmer that time I used to code rather use the studio to develop custom component and coding. Though some the localization could be done partially using the VS IDE, many part was was complex and need to modify C#,VB.net and JavaScript code. So, I preferred only coding without visual aid.
In addition to the enjoyment and freedom, end of the week I got quite a good pay
Now, I am really thinking should I continue with free lancing?
Leave a Comment » |
ASP.net, C++, Fedex, Freelancing |
Permalink
Posted by Aman
February 1, 2008
I am always a fan of Java. And like NetBeans as well. Though it used to be slow, but the latest release netbeans 6 is super fast, it may be due to the latest jre. Using the the latest jre, old java swing applications are now super fast!!! Believe me, better else try yourself. I am sure swing will come well into the desktop market in near future (it till then the desktop idea survives
)
Anyway, I was searching for an IDE for PHP with auto completion feature. Having downloaded the netbeans6 I was surprise to find a plug-in named PHP! Downloaded it and got exactly what I was looking for
For more information visit Php plug-in for netbeans.
1 Comment |
PHP |
Permalink
Posted by Aman