Possible Duplicate:
Is there a way to program 100% object-oriented in PHP?
What I am trying to accomplish would look something like this:
<?php
//index.php
class Site{
public static function main(){
// starts all the processing of the site
}
}
?>
So that when someone visits the site’s index.php the site will start up without having any code outside the class.
Yes I know that I could use __autoload or even spl_autoload_register to handle autoloading of classes but that would still most likely need to be added outside of the class.
I have my doubts that this is possible but I don’t know why this wouldn’t be possible.
No.
Java’s entry point is defined as the
mainmethod. PHP’s entry point is defined as the first line in the first file that gets executed. You will have to start with “procedural” code.