《外文文献- PHP的优点.docx》由会员分享,可在线阅读,更多相关《外文文献- PHP的优点.docx(4页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、外文科技资料翻译英文原文Where PHP Fits InPHP is a scripting language originally designed for producing dynamic web pages. It ha s evolved to include a command line interface capability and can be used in standalone gra phical applications. While PHP was originally created by Rasmus Lerdorf in 1995, the mai n im
2、plementation of PHP is now produced by The PHP Group and serves as the de facto st andard for PHP as there is no formal specification. PHP is free software released under the PHP License, however it is incompatible with the GNU General Public License (GPL), du e to restrictions on the usage of the t
3、enn PHP.PHP is a widely-used general-purpose scripting language that is especially suited for we b development and can be embedded into HTML. It generally nins on a web server, taking PHP code as its input and creating web pages as output. It can be million websites and 1 million web servers.PHP has
4、 hundreds of base functions and thousands more via extensions. These function s are well documented on the PHP site, but unfortunately, the built-in library has a wide va ricty of naming conventions and inconsistencies. PHP cuiTcntly has no functions fbr thread programming.Functions are not first-cl
5、ass functions and can only be referenced by their name-directl y or dynamically by a variable containing the name of the function. User-defined functions can be created at any time without being prototyped. Functions can be defined inside code blocks, permitting a run-time decision as to whether or
6、not a function should be defined. F unction calls must use parentheses, with the exception of zero argument class constructor f unctions called with the PHP new operator, where parentheses are optional. PHP supports quasi-anonymous functions through the create_function() function, although they are
7、not tr ue anonymous functions because anonymous functions are nameless, but functions can onl y be referenced by name, or indirectly through a variable $function_name();, in PHP.PHP gained support fbr first-class functions and closures. True anonymous functions are supported using the following synt
8、ax: function getAdder($x) return function ($y) use ($x) return $x + $y; ;)Sadder = gctAddcr(8); echo $addcr(2); / prints 10Here, getAdder() function creates a closure using parameter $x (keyword use forces g etting variable from context), which, etc. For more details see Lambda functions and closu r
9、es RFC.Basic object-oriented programming functionality was added in PHP 3 and improved in PHP 4. Objecl handling was completely rewritten for PHP 5, expanding the feature set and enhancing pertbnnance. In previous versions of PHP, objects were handled like primit ive types. The drawback of this meth
10、od was that the whole object was copied when a varia ble was assigned or passed as a parameter to a method. In the new approach, objects are re ferenced by handle, and not by value. PHP 5 introduced private and protected member vari ables and methods, along with abstract classes and final classes as
11、 well as abstract methods and final methods. It also introduced a standard way of declaring constructors and destruct ors, similar to that of other object-oriented languages such as C+, and a standard exceptio n handling model. Furthermore, PHP 5 added interfaces and allowed fbr multiple interface s
12、 to be implemented. There arc special interfaces that allow objects to interact with the runt ime system. Objects implementing ArrayAccess can be used with array syntax and objects implementing Iterator or IteratorAggregate can be used with the fbreach language constni ct. There is no virtual table
13、feature in the engine, so static variables are bound with a name instead of a reference at compile lime.If the developer creates a copy of an object using the reserved word clone, the Zend engi ne will check if a _clone() method has been defined or not. If not, it will call a default c lonc() which
14、will copy the objects properties. If a _clonc() method is defined, then it will be responsible for setting the necessary properties in the created object. For convenience, t he engine will supply a function that imports the properties of the source object, so that the programmer can start with .出处:P
15、rofessional PHP Third Edition Martin ChristopherKarliJames Kalbach中文译文PHP的优点PHP是一种脚本语言,最初用于生产动态网页设计。它己开展到包括一个命令 行界面的能力,可以在独立的图形应用程序中使用。虽然PHP最初由Rasmus Lerdorf创立于1995年,PHP的主要执行现所产生的 PHP集团和PHP的事实上的标准服务,因为没有正式的规范。PHP是PHP的免费软 件许可证下发布的,但它是用GNU通用公共许可证(GPL),由于对长期PHP的使用 限制不相容的。PHP是一种广泛使用的通用目的脚本语言,特别适合于Web开发,
16、可嵌入到HTML 中。它通常运行在Web服务器上,以它的输入PHP代码和创立作为输出的网页。它 可以部署在大多数网络服务器和几乎所有的操作系统和平台免费的。函数可以创立在任何时候被原型。函数可以被定义代码块内,允许在运行时决 定是否或不是一个函数应该被定义。函数调用必须使用括号,在无参数的构造函数 与类的PHP新的运营商,在括号是可选的所谓功能异常。PHP支持通过 create_function ()函数类似匿名函数,虽然他们不是真正的匿名函数,因为匿名 函数是无名,但功能只能引用的名称或间接地通过一个变量$ function_name ();, 在PlIPo PHP中获得了一流的功能和封锁的
17、支持。真正的匿名函数支持使用以下语 法:功能getAdder($ x)的(返回函数($ y)的使用($ 乂)的( 返 回X元+ Y元;);)$加法器二getAdder(8); 回声$加法器(2)/ /输出“10”在这里,get Adder ()函数创立一个封闭使用参数$ X (关键字“,用”势力 越来越变量从上下文),它需要额外的参数$ y,并返回给调用者。这种功能可以 存储,给出了更详细的参数到另一个功能等见lambda函数和关闭变更请求。基本的面向对象编程功能被添加在PHP 3和PHP 4的改进。3对象处理是完 全改写为PHP 5,拓展功能和增强性能。在以前版本的PHP,对象处理方式和原始
18、 类型。这种方法的缺点是,整个对象被复制时,被分配一个变量或作为参数传递到 一个方法。在新方法中,对象引用的处理,而不是价值。PHP 5中引入私有和受 保护的成员变量,随着最后的抽象类和抽象类以及方法和最终方法方法。它还介绍 了申报,如C + +构造函数和析构,类似于其它面向对象语言的标准方法,以及 一个标准的异常处理模型。此外,PHP 5中添加接口和多个接口允许实施。有迹象说明允许对象进行交互运行时系统的特殊接口。对象实施ArrayAccess可以使用数 组语法和对象实施的Iterator或IleralorAggregale可以用在foreach用的语言构 造。有没有在发动机虚拟表功能,因此静态变量约束,而不是在编译时引用的名称。如果开发人员创立一个对象的副本使用保存字克隆,在Zend引擎将检查一个 -clone ()方法已经定义或没有。如果不是,它会调用默认_clone ()将复制对 象的属性。如果_clone ()方法的定义,那么这将是在设置必要的属性创立的对象 的责任。为方便起见,发动机将提供一个函数,进口源对象,使程序员可以从一个 源对象按值复制,只覆盖属性需要改变的属性。出处:作者:Professional PHP Third EditionMartin ChristopherKarliJames Kalbach