hi,
in java this is a syntax for creating an object for class.
hello obj=new hello();
where as in php this is the syntax.
$obj = new Java("hello");
now i want to cal constructor with parameters, here the syntax for java.
hello obj=new hello("key");
pls give syntax for the above in php.
thanks and regards.
java classes in php
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Re: java classes in php
Code: Select all
$variableNameForObject = new ClassName($parameters, $go, $here);Re: java classes in php
Indeed there is, and you didn't read it either. He's talking about PHP's Java built-in object, not a normal class.ole wrote:Also, there's a manual for this stuff.
http://uk3.php.net/manual/en/java.examples.php
Code: Select all
$obj = new Java("hello", "parameter1", "parameter2", "parameter3");- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Re: java classes in php
Sorry ismail I misinterpreted what you were asking.
I'm not quite sure how to respond to you onion2k.
I'm not quite sure how to respond to you onion2k.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: java classes in php
if PHP stays true to form, you could try the following syntax (untested, but worth a try):
Code: Select all
$obj = new Java( array("class_name", "constructor_argument") );