Re: Object execution

From: Date: Tue, 28 Jun 2005 22:59:38 +0000
Subject: Re: Object execution
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-16972@lists.php.net to get a copy of this message
For example... --- example.php --- <?php class Example { public function __main() { echo "Hello World!"; } } ?> --- end example.php --- php -q example.php would output "Hello World!" With this you could potentially eliminate the global scope if you chose to. For the record, by no means do I want PHP to be Java. I just think this feature would be a nice finishing touch to a very OOP style app. Otherwise you basically have to have a one liner to call something like app::run(). On 6/28/05, Nicolas Bérard Nault <nicobn@gmail.com> wrote: > What do you mean by the script being a class ? > > On 6/28/05, Jesse Binam <sirbinam@gmail.com> wrote: > > Any thoughts on the idea of a magic method called "__main()" or > > "__exec()" that would be called if the script being executed is a > > class. > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > Nicolas Bérard Nault (nicobn@gmail.com) > "Maybe nature is fundamentally ugly, chaotic and complicated. But if > it's like that, then I want out." -- Steven Weinberg (prix Nobel de > physique, 1979). >

« previous php.internals (#16972) next »