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 <[EMAIL PROTECTED]> wrote:
> What do you mean by the script being a class ?
> 
> On 6/28/05, Jesse Binam <[EMAIL PROTECTED]> 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 ([EMAIL PROTECTED])
> "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).
>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to