转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 数据库 >> ORACLE >> 正文
PHP 5, Oracle, and the Future         ★★★★

PHP 5, Oracle, and the Future

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1003 更新时间:2009/4/22 21:58:31

PHP 5, Oracle, and the Future
by Andi Gutmans

Get an overview of the some of the new features in PHP 5 and its future by PHP 5's release manager

PHP 5 (PHP: Hypertext Preprocessor Version 5) was officially released on July 13, 2004. Not surprising, 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 led PHP to be the leading Web application development language.

You might ask yourself, since PHP 4 featuring the Zend Engine I was so successful, why do we even need PHP 5 and the Zend Engine II? The truth is that there were certain areas in which PHP 4 did not excel. Most of these areas were more important for large projects and companies, where project management is more structured and interoperability between systems is a must. PHP 5 addresses these issues, allowing PHP not only to be more attractive for such projects but also to remain the leading technology for Web application development.

In this article I cover:

  • The reasoning behind PHP 5
  • A short overview of some of the new features
  • A brief look at the future for PHP and Oracle users

The New Object-Oriented Model of the Zend Engine II

Background. With PHP's adoption growing steadily, its use in larger projects is also constantly increasing. There does seem to be a connection between large projects and the use of object-oriented (OO) methodology. Not that you can't write a small OO application, and it is certainly possible to write large, impressive applications without OOP (Object Oriented Programming); however, there does seem to be a tendency to pick the object-oriented paradigm in these cases. It is probably mainly due to OOP having more conventional tools for functional and technical design (UML — Unified Modeling Language), reuse of solutions for recurring problems (design patterns), and built-in mechanisms in the OO languages themselves that help enforce software designs and contracts.

The main problem with PHP's object model in prior versions was that objects were implemented as native types with copy-semantics similar to integers and strings. This not only led to some very confusing behavior, due to sometimes unexpected implicit object cloning by PHP, but it also didn't allow us to implement some basic features, such as the ability to de-reference objects that are returned from methods.

The following examples illustrate these two problems.
a) Implicit object cloning:

<?php

class 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();

?>

Most developers would expect this example to print out "andi" However, surprisingly, this example prints out "Andi" in PHP 4. This is due to the previously mentioned way PHP 4 treats objects like regular native types, and as a result, passing $obj to lowerCaseName() by-value, actually clones the object. The resulting manipulation that lowerCaseName() performs on $obj is done on a cloned version of the object. This behavior not only leads to surprising results but, for developers who were aware of this problem, it would require passing and returning objects by-reference, which would make the code harder to maintain because they'd have to insert & signs in many places (passing by-reference, returning by-reference, and assigning by-reference).

b) Inability to de-reference objects returned from methods:

$obj->getParentObject()->method();

If you aren't very familiar with PHP 4, you would probably expect this example to work. However, as a result of the before-mentioned implicit cloning, the ability to de-reference an object that is returned from a method did not exist and could not be implemented. As a workaround, a lot of PHP 4 code would look as follows:





[MySql]PHP存取 Mysql 数据乱码终极解决方案  [Web开发]PHP提示Notice: Undefined variable的解决办法
[Web开发]PHP 大小写函数  [Web开发]PHP的sleep函数关闭窗口后是否继续运行?
[Web开发]教你如何在PHP开启gzip页面压缩实例介绍  [Web开发]PHP过滤HTML字符串的常用函数使用方法介绍
[Web开发]PHP采集程序常用函数大全  [Web开发]用PHP实现Javascript的escape(),unescape()的方法
[Web开发]常见的PHP截取字符串函数整理  [Web开发]VS2005+SQL2005之.NET2.0数据库连接
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Sql Server  · MySql
    · Access  · ORACLE
    · SyBase  · 其他
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台