note 68705 deleted from ref.java by betz

From: Date: Tue, 08 Aug 2006 10:06:59 +0000
Subject: note 68705 deleted from ref.java by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-115627@lists.php.net to get a copy of this message
Note Submitter: kewl_n_chill at yahoo dot com ---- I have successfully integrated PHP and Java using php-java bridge. I want to have notes on how to use this package. I am able to run small java programs including Threads too. e.g. php: <? $thread=new Java('java.lang.Thread'); for($i=0;$i<10;$i++){ echo " \n ". $i . " hello "; $thread->sleep(1000); } ?> OUtput: Code: C:\test\javatest>php test4.php 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9 hello Another small program php: <? class MyThread{ function __construct($msg){ $obj=new JavaClass("java.lang.Thread"); $thread=$obj->newInstance(); $thread->setName($msg); echo " \nThread " . $thread->getName() . " Running "; $thread->sleep(3000); } } $a= new MyThread("hello world"); $b= new MyThread("there is me"); ?> Output: Code: C:\test\javatest>php test6.php Thread hello world Running Thread there is me Running But I wanna know how we can extend any Java class in php and override any methods. e.g. If we are extending Thread class , then how can we override public void run() method and start the thread. Further do we have any synchronized keyword as we have in Java.

« previous php.notes (#115627) next »