public class phptest{ /** * a sample of a class that can work with php * nb: the whole class must be public to work, * and of course the methods you wish to call * directly. * * also note that from php the main method * will not be called */
public string foo;
/** * takes a string and returns the result * or a msg saying your string was empty */ public string test(string str) { if(str.equals("")) { str = "your string was empty. "; } return str; }
/** * whatisfoo() simply returns the value of the variable foo. */ public string whatisfoo() { return "foo is " + foo; }
/** * this is called if phptest is run from the command line with * something like * java phptest * or * java phptest hello there */ public static void main(string args[]) { phptest p = new phptest();