PHP4的新特性
PHP 4.0 是更有效的,更可靠的动态Web页开发工具,在大多数情况运行比 PHP 3.0 快,其脚本描述更强大并且更复杂, 最显著的特征是速率比的增加。PHP4.0 这些优异的性能是PHP 脚本引擎重新设计产生的结果:引擎由 AndiGutmans 和 Zeev Suraski从底层全面重写。PHP4.0 脚本引擎 - Zend 引擎 - 使用了一种更有效的“编译——执行”范式, 而不是PHP 3.0 采用的“执行 ——当解析时”模型。
PHP4在3.0版的基础上增加或增强了许多有用的特征,主要如下:
(1)别名
在PHP4中,可以利用引用为变量赋值,这给编程带来了很大的灵活性。
(2)扩充了API 模块
PHP 4.0 为扩展的 API 模块的提供了扩展PHP接口模块, 它比旧的 API 版本显著地快。 PHP 模块已有的及最常用的接口多数被转换到使用这个扩展的接口。
(3)自动资源释放
PHP4增加了引用计数功能,这种新技术的引入使PHP4具有了自动内存管理功能,减轻了开发人员的负担。
(4)布尔类型
PHP 4.0 支持布尔类型。
(5)进程生成
在 UNIX 环境下的 PHP 4.0 提供了一个很智能和通用的生成进程, 使用了一种名为基于automake/libtool的系统生成技术。
(6)COM/DCOM 支持
PHP 4.0 提供 COM/DCOM 支持 ( 仅用于Windows 环境 ) 可以无缝地存取和访问 COM 对象。
(7)与PHP 3.0 相容性很好
PHP 4.0 是与 PHP 3.0 代码向后兼容性接近100% 。由于 PHP 4 的改进的体系结构,两者有一些细微的差别,但是大多数人将可能永远不可能遇上这种情况。
(8)配置
PHP4重新设计和增强了PHP。ini文件,这使得用PHP。ini来配置PHP显得极为容易,这个文件可以在运行时被Apache(unix系统)或由Windows 注册(Windows 环境)。
(9)加密支持
PHP4实现了完整的加密, 这些加密功能是一个完整的mycrypt库,并且 PHP 4.0 支持哈希函数。Blowfish,TripleDES,MD5,并且SHA1 也是可使用的一些加密算法。
(10)类型检查
PHP 4.0 支持同一操作符用于评类型检查:"==="( 3 等号运算符 ), 为在两个值和其类型之间作检查。例如,“ 3 ” ===3 将视为假 ( 类型是不同的 ), 而“ 3 ” ==3 ( 相等判断 ) 将视为真。
(11)FTP 支持
PHP 4.0 支持 FTP 。通常, 你会为通过一个调制解调器连接下载一个大文件提供一个网接口。然而, 如果你确有需要,你可以用PHP 。
(12) PHP4新增函数或功能增强函数
PHP 4.0 新增了许多函数,同时也将许多现有的函数功能进行了增强,以下是一些例子。
array_count_values()
eval()
foreach()
nclude()
ob_end_clean()
ob_end_flush()
ob_get_contents()
ob_start()
strip_tags()
unset()
(13)"here”打印
PHP 4.0 的“Here”打印是与Perl类似的, 尽管完全不相同。“Here”是打印大容量文章的一个有用的方法,例如在 HTML文件中,不会漏掉任何一个字符,例如目录标记。
(14)HTTP Session fallback 系统
为 HTTP Session管理的一个 fallback 系统在 PHP 4.0被实现 。缺省情况下,Session标识符由cookies存储。如果没有cookies支持或一项cookies任务失败,Session标识符自动被创建并在 URL 的查询字符串中被携带。
(15)ISAPI 支持
PHP 4.0 能作为一个个性化的 ISAPI 模块作为 IIS插件 。这比 PHP 3.0 更有效, 它作为CGI 运行 ( 一个外部的程序 )。
(16)内存
PHP 4.0 能更有效的使用内存, 导致较少的内存占用消耗,这主要归功于引用计数技术的实现。
(17)其他类成员函数
在 PHP 4.0 你能在成员函数本身的作用域或全局范围内调用其他类的成员函数。例如,你能用一个子函数覆盖父函数,并在子函数中调用父函数。
(18)多维数组
在 PHP 4.0 ,利用GET,POST,Cookies的进行的数据传输支持多维数组。
(19)个性化的 HTTP Session支持
HTTP Session处理, 包括 fallback 系统管理,在 PHP 4.0被它的新库函数实现 。在版本 3.0 中处理Session要求使用 PHPLIB 和第三方的库函数, 它比把Session直接地由 PHP 支持慢了许多。
(20)个性化的 Java 支持
PHP 4.0 支持和java的交互。这种个性化的Java 支持为PHP 在 Java 对象上创建和使用方法提供一个简单并且有效的工具。
(21)对象和数嵌套组
PHP 4.0 实现了功能更加强大的对象, 移去了 PHP 3.0种 存在的句法限制。对象能在数组以内被嵌套并且反过来也如此, 可以根据你的需要实现嵌套。
(22)面向对象的编程
PHP 4.0 为面向对象的编程和构造类及对象提供扩展的功能和新特征。PHP4实现了对象重载,引用技术等新技术。
(23)对象重载支持
对象重载语法允许第三方的基于面向对象的类库使用 PHP4 的面向对象的特征存取他们自身的功能。使用这个特征的一个 COM 模块已经被实现了。
(24)输出缓冲支持
PHP 提供了一个输出缓冲函数集合。输出缓冲支持允许你写包裹函数功能压缩缓冲区。在 PHP4 的输出缓冲支持允许 HTML 头信息存放, 无论 HTML的正文是否输出。头信息( (header(), content type, and cookies ) 不采用缓冲 。
(25)增加了PCRE 库
PHP 4.0 包括一个 Perl 兼容的正则表达式 (PCRE ) 库, 和正常regex库一起与 PHP 绑定。split 和replace PCRE 功能被支持。PCRE 和 Perl 正规表达式之间有一些细微差别。
(26)php.ini 文件
php.ini文件在 PHP4.0 被重新设计, 使用的 PHP 的配置php.ini是更容易并且更有效的。全部文件能被Apache 在运行时间操作 ( 在 Apache环境 下 ) 或由 Windows 注册表 ( 在 Windows 下面 ) 。被加入php.ini文件的配置指令自动地在所有相关的模块中被支持。
(27)引用计数
PHP 4.0 为系统中的每个数值提供了引用计数, 包括资源。一旦一个资源不再被任何变量引用,它自动地被释放以节省内存资源。利用这个特征的最明显的例子一个内置SQL查询的循环语句。在PHP 3.0中 ,每次递归另外的 SQL 结果集合重复申请内存,直到脚本执行完毕,这些结果集合占用的内存才被释放。
(28)支持引用
通过引用可以改变一个变量的值。
(29)函数的运行时绑定
PHP 4.0 的运行时间绑定功能允许你在他们被声明以前调用, 无论声明是否在代码以后或是在运行时间。
(30)类的运行时信息
PHP 4.0 支持在运行时刻存取下列类信息:一个对象的类名,一个对象的父类的类名字,以及对象函数所在的名字。
(31)服务器抽象层
为支持Web服务器提供了增强型 SAPI ( 服务器 API ) 接口,是 PHP 4。0 不可分的一部分。这个服务器抽象层,提供了通用的WEB服务器接口支持,支持多线程WEB服务器,为大多数的WEB服务器提供透明的支持, 这些服务器包括 Apache ,IIS ( ISAPI ), 以及 AOL 服务器。
(32)语法的点亮显示
PHP 4.0 语法的点亮显示允许开发者看见源代码而不是脚本, 这个功能比PHP 3。0中的更有效。它跑得更快,更执行得更好,并且产生更紧凑的HTML代码。
(33)由引用改变变量的值
PHP 4.0 由引用支持可变的赋值, “关联”的2个变量之中个的任何一个的值被改变,另外的变量的值同样被改变,这类似与C中的指针类型。
(34)在引用字符串中的变量引用
PHP 4.0 增强了在引用字符串中的变量引用。例如, 这个例子在 PHP 3.0中 是不可能做到的 : print "${a[0]->bingo}";

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.
