Reply to Re: PHP OO Java Main Method equivalent???

Your name:

Reply:


Posted by C. on 06/15/07 21:10

On 15 Jun, 15:57, pelon <pelonbiol...@gmail.com> wrote:
> Hey!
>
> I'm new to OO in PHP but somewhat familiar with this paridigm in
> JAVA....
>
> So I was wondering if it is possible to have within a PHP script
> something equivalent to a main method as it is possible in JAVA....
>

First thing is the PHP, unlike Java has first class functions. Second
thing, is that PHP, like most scripting languages has an implicit
entry point at the beginning of the invoked file so all you need to do
is this:

BOF>>>>>>>>>>>
<?php

$obj = new myclass();

class myclass{
//my class's code
}

?>
<<<<<<<<<<<EOF

Although its generally considered neater to put class definitions in
their own include file so...

BOF>>>>>>>>>>>
<?php

require_once('myclass.inc.php');
$obj = new myclass();

?>
<<<<<<<<<<<EOF

HTH

C.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация