class Blah {
public static function
hello($id) {
printf("Static");
}
public function
hello() {
printf("Instance");
}
}
Blah::hello(5);
$x = new Blah();
$x->hello();
You knows it...
Update: To Clarify My Intentions
So I was building a very quick ORM class and thought for ease of use it would be a nice to provide both static and instance methods to delete().
For example:
Blah_Model::delete(1234); $blah = new Blah_Model(1234); $blah->delete();
I don't see any problem with redeclaring methods as long as they're in different contexts, I don' care for PHP4 compatibility, but unfortunately this isn't how PHP works.
Now .. it can be done using __callstatic with PHP 5.3, this isn't the approach I took. Instead I implemented a check for $this:
class Blah {
function delete( $id = NULL ) {
if( isset($this) ) {
printf("Instance Method\n");
}
else {
printf("Static Method\n");
}
}
}
