Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

<?


$mailbox = imap_open("{mail.server.com}INBOX",
"leon", "password");
imap_unsubscribe($mailbox, "PHP");
imap_close($mailbox);
?>


string imap_utf7_decode(string data)


The imap_utf7_decode function takes UTF-7 encoded text and returns plain text.


string imap_utf7_encode(string data)


The imap_utf7_encode function returns UTF-7 encoded text.


Java


The coolest addition to PHP in 1999 was the code Sam Ruby added to allow PHP to use
Java objects. Java is Sun's object-oriented language intended to be platform independent.
Java is very popular, and you won't have any trouble finding books, Web sites, and free
source code. Perhaps the best place to get information about Java used on Web servers is
the Java Apache Project http://java.apache.org/.


The Java extension doesn't create any new functions, but it exposes a class called Java.
You can use the new operator to instantiate any class in your class path. An object is
returned that can be treated like any other PHP object. Its properties and methods match
the Java class.


<?


/*


* Adapted from Sam Ruby's example
/


//get version of Java
$system = new Java("java.lang.System");
print("Java version: ".
$system->getProperty("java.version").
"
\n");


//print formatted date
$formatter = new Java("java.text.SimpleDateFormat",
"EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");

Free download pdf