Using __toString(), you can actually return a value for the object/instance of a class.
See the example below:
class MyClass{
function __construct(){
// constructor
}
function __toString(){
// to String
return 5;
}
}
$inst = new MyClass();
echo $inst; // echos 5How powerful!


2 comments:
Wow man! Cool stuff! Ever tried running your stuff on Windows? Do some benchmarking?
- Chris
(chism@microsoft.com)
Hi Chris
Yeah I running Windows, but using Apache instead of IIS because I had to emulate linux server which are used for production.
Yeah I ran PHP on IIS before by adding the PHP dll as filter to run all *.php files.
Cheers
Sam
Post a Comment