PHP 5, Oracle, and the Future
PHP 5, Oracle, and the Future
PHP 5 (PHP: Hypertext Preprocessor Version 5) was officially released on July 13, 2004. Not surprisingly, the release was widely covered by the media due to the leadership role PHP plays in the Web application market. It is true that technologies such as .NET and J2EE have had more exposure and hype than PHP, but ease-of-use, performance, tight integration with the Apache Web server, and a large collection of application building blocks have made PHP one of the leading Web application development languages.
<?phpclass Person {var $name;function Person($name) {$this->name = $name;}function setName($name) {$this->name = $name;}function getName() {return $this->name;}}function lowerCaseName($obj){$new_name = strtolower($obj->getName());$obj->setName($new_name);}$obj = new Person("Andi");lowerCaseName($obj);print $obj->getName();?>
$objlowerCaseName()lowerCaseName()$obj
$obj->getParentObject()->method();
$temp_obj &= $obj->getParentObject();$temp_obj->method();
cloneclone $obj;__clone()
$ie = new COM("InternetExplorer.Application"); $ie->Visible = true; $ie->Navigate("http://www.php.net/");
__autoload()instanceof
<?phpclass MySingleton {static private $instance = NULL;private function __construct() {}private function __clone() {}static public function Instance() { if (self::$instance == NULL) {self::$instance = new MySingleton();}return self::$instance;}// ... Additional code for the MySingleton class.}
privateMySingletonself::$instanceprivate
changeStmt()
<?phpfinal class ImmutableQueryStatement { private $stmt; public function __construct($stmt) { $this->stmt = $stmt; } public function getStmt() { return $this->stmt; } public function changeStmt($stmt) { return new ImmutableQueryStatement($stmt); }}
finalchangeStmt()
It was decided to rewrite the XML support in PHP 5, and a few developers from the PHP community stepped up to make this rewrite a reality. The first and most important decision was that all XML functionality be based on the excellent libxml2 library from the Gnome's project. With this in mind, all three existing extensions were rewritten. Most important, the DOM extension was revamped and its interface redefined to be W3C-compliant. At the time of PHP 5's release, DOM was no longer experimental but full-featured and stable.
<clients><client> <name>John Doe</name> <account_number>87234838</account_number></client><client> <name>Janet Smith</name> <account_number>72384329</account_number></client></clients>
<?php$clients = simplexml_load_file('clients.xml');foreach($clients->client as $client) { print "$client->name account: $client->account_number\n";}
John Doe account: 87234838Janet Smith account: 72384329
With SimpleXML, accessing XML files becomes extremely easy. I have no doubt that SimpleXML will revolutionize the ease-of-use provided to the PHP developer for dealing with XML files. And if there are certain things SimpleXML cannot do, then due to the fact that both SimpleXML and the DOM extension use the same underlying library, the SimpleXML object can be converted to a DOM tree and more-advanced XML manipulations can be done in DOM. This conversion back and forth between SimpleXML and DOM is zero-copy, meaning it costs neither time nor additional memory.
<?php$client =new SoapClient("http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl"); print($client->getQuote("ORCL"));
11.23.
(is a very interesting third-party project. It is a project that implements a proxy broker for SQL connections (including Oracle), allowing for connection pooling of database connections using PHP.
Using connection pooling, you can limit the amount of open connections to the database. Getting up and running with SQL Relay, although not trivial, is quite simple. I'd also like to note that the SQL Relay author was very responsive to my questions.
You have to use a different API than the PHP Oracle extension. Result sets are copied twice: first to the SQL Relay broker and then to PHP. You don't have as rich an API as you do when using PHP's native oci8 extension.
, by Wez Furlong, suffice to say that PDO is something to watch. PHP has been waiting for quite some time for good native database abstraction. I believe that PDO may very well be the solution we have all been waiting for. The designers of PDO are some of the lead developers of the PHP community, and I like their approach with PDO. The following is a list of their design goals, as written in the PDO README file:
Propel is a very interesting project and can come in handy. In addition, it is built on top of a database abstraction layer called Creole. Unlike PDO, this abstraction layer tries to mimic JDBC as much as possible and might be easier to use if you are converting existing Java code to PHP. That said, if PDO becomes mainstream and is distributed as part of standard PHP, it might be best to stick with that.
to define a standard on how to bridge between PHP and Java. Today the JSR's expert group comprises many software vendors, including Oracle. Although the JSR talks about all scripting languages, the initial interest was in PHP and mainly the possibility of calling Java code from PHP. You can guess that one of the primary motives for such connectivity would be to connect front-end PHP servers to back-end J2EE application servers and, more specifically, the ability to call Enterprise Java Beans (EJBs) directly from PHP code.
You can see that what you'll be able to do is write Java code in PHP. This should allow you to call any Java business logic you might have, specifically EJBs.
More specifically, I think Oracle users have a lot to look forward to. With Oracle's published Statement of Direction regarding PHP inclusion in future Oracle Application Server releases, it is clear that the company has recognized the importance of PHP technology. I believe that following this recognition will come a variety of solutions that will improve Oracle/PHP productivity and flexibility, both very much required in today's ever-changing market. The initial bundling of PHP in the upcoming version of Oracle 10g and the PHP extension for Oracle JDeveloper are significant first steps for widespread PHP support by Oracle.
PHP 5 Power Programming (Prentice Hall). He welcomes suggestions about PHP 5 at