PHP 手册
附录

Changelog

The following changes have been made to functions of bundled extensions.

VersionFunctionDescription
Since 5.3.0get_classNULL became the default value for object, so passing NULL to object now has the same result as not passing any value.
Since 5.2.1mt_srandThe Mersenne Twister implementation in PHP now uses a new seeding algorithm by Richard Wagner. Identical seeds no longer produce the same sequence of values they did in previous versions. This behavior is not expected to change again, but it is considered unsafe to rely upon it nonetheless.
Since 5.0.0get_classThe class name is returned in its original notation.
 get_classThe object parameter is optional if called from the object's method.
 get_parent_classThe object parameter is optional if called from the object's method.
Since 4.2.0mt_srandThe seed becomes optional and defaults to a random value if omitted.
 srandThe seed becomes optional and defaults to a random value if omitted.
Since 4.1.0bindecThe function can now convert numbers that are too large to fit into the platforms integer type, larger values are returned as float in that case.
 octdecThe function can now convert numbers that are too large to fit into the platforms integer type, larger values are returned as float in that case.
Since 4.0.5get_parent_classIf object is a string, returns the name of the parent class of the class with that name.
prior to 5.3.0get_object_varsIf the object isn't an object, then get_object_vars would return FALSE
Prior to 5.1.3imagecolorallocatealphaReturns -1 if the allocation failed.
Prior to 4.2.0get_class_varsUninitialized class variables will not be reported by get_class_vars
prior to 4.2.0get_object_varsIf the variables declared in the class of which the object is an instance, have not been assigned a value, those will not be returned in the array
PHP 5.3.2 (PECL OCI8 1.4)oci_set_prefetchBefore this release, rows must be >= 1.
PHP 5.3 (PECL OCI8 1.3.4)oci_set_prefetchBefore this release, prefetching was limited to the lesser of rows rows and 1024 * rows bytes. The byte size restriction has now been removed.
PHP 4.3.3ftruncatePrior to this release ftruncate returned an integer value of 1 on success, instead of boolean TRUE.
Before 5.1.0get_parent_classIf called without parameter outside object, this function would have returned NULL with a warning.
before 4.3.5dba_openopen mode "c" is broken for several internal handlers and truncates the database instead of appending data to an existent database. Also dbm and ndbm fail on mode "c" in typical configurations (this cannot be fixed).
5.4.0apache_child_terminate该函数目前也可以用于FastCGI模式了。以前,它仅在PHP作为Apapche的模块安装时支持。
 apache_request_headersThis function became available under FastCGI. Previously, it was supported only when PHP was installed as an Apache module.
 apache_response_headersThis function became available under FastCGI. Previously, it was supported only when PHP was installed as an Apache module.
 date_default_timezone_getThe TZ environment variable is no longer used to guess the timezone.
 date_default_timezone_getThe timezone is no longer guessed from information available through the operating system as the guessed timezone can not be relied on.
 emptyChecking non-numeric offsets of strings returns TRUE.
 getallheadersThis function became available under FastCGI. Previously, it was supported only when PHP was installed as an Apache module.
 issetChecking non-numeric offsets of strings now returns FALSE.
 json_decodeThe options parameter was added.
 json_encodeoptions 参数增加常量: JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, 和 JSON_UNESCAPED_UNICODE。
 scandirsorting_order now accepts constants. Any nonzero value caused descending order in previous versions.
 session_set_save_handlerAdded SessionHandlerInterface for implementing session handlers and SessionHandler to expose internal PHP session handlers.
 snmp_set_valueretrievalConstants SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY may be combined with SNMP_VALUE_OBJECT resulting different way of representing contents of value array element in return value of GET-function. If no SNMP_VALUE_{PLAIN,LIBRARY} constant is accompanying SNMP_VALUE_OBJECT, SNMP_VALUE_LIBRARY is used. Prior to 5.4.0 SNMP_VALUE_OBJECT effecively meant SNMP_VALUE_OBJECT|SNMP_VALUE_PLAIN.
 SoapClient::SoapClientNew keep_alive option.
5.3.9is_subclass_ofAdded allow_string parameter
5.3.6DateTime::modifyAbsolute date/time statements now take effect. Previously, only relative parts were used.
 DOMDocument::saveHTMLThe node parameter was added.
 PDO_MYSQL DSNPrior to version 5.3.6, charset was ignored.
5.3.4rawurlencodeTilde characters are no longer encoded when rawurlencode is used with EBCDIC strings.
5.3.3DOMXPath::evaluateThe registerNodeNS parameter was added.
 DOMXPath::queryThe registerNodeNS parameter was added.
 json_encodeoptions 参数增加常量:JSON_NUMERIC_CHECK。
 ldap_sasl_bindSupport on Windows was added.
 openssl_decryptThe iv parameter was added.
 openssl_encryptThe iv parameter was added.
 parse_urlRemoved the E_WARNING that was emitted when URL parsing failed.
5.3.2flockThe automatic unlocking when the file's resource handle is closed was removed. Unlocking now always has to be done manually.
 gmp_initThe base was extended from 2 to 36, to 2 to 62 and -2 to -36.
 gmp_strvalThe base was extended from 2 to 36, to 2 to 62 and -2 to -36.
 imap_appendAdded INTERNALDATE support to imap_append.
 imap_openparams added
5.3.1ibase_queryOn success the function now returns TRUE if there were no affected rows, where it previously returned 0 (a zero followed by an empty space).
 renamerename can now rename files across drives in Windows.
5.3.0DateTime::__constructIf an invalid date is specified, then an exception is now thrown. Previously an error was emitted.
 DateTime::modify将返回值从NULL改为 DateTime 类型。
 DateTime::setDate将返回值从NULL改为 DateTime 类型。
 DateTime::setISODate将返回值从NULL改为 DateTime 类型。
 DateTime::setTime将返回值从NULL改为 DateTime 类型。
 DateTime::setTimezone将返回值从NULL改为 DateTime 类型。
 DateTimeZone::getTransitionsThe optional timestamp_begin and timestamp_end were added.
 DateTimeZone::listIdentifiersAdded the optional what and country parameters.
 acoshThis function is now available on all platforms
 asinhThis function is now available on all platforms
 atanhThis function is now available on all platforms
 call_user_funcThe interpretation of object oriented keywords like parent and self has changed. Previously, calling them using the double colon syntax would emit an E_STRICT warning because they were interpreted as static.
 call_user_func_arrayThe interpretation of object oriented keywords like parent and self has changed. Previously, calling them using the double colon syntax would emit an E_STRICT warning because they were interpreted as static.
 checkdnsrrThis function is now available on Windows platforms.
 clearstatcache增加了可选的 clear_realpath_cache 和 filename 参数.
 copyAdded context support.
 define_syslog_variablesThis function now throws an E_DEPRECATED notice.
 dns_get_recordThis function is now available on Windows platforms.
 dns_get_recordPrior to this release, if the authns parameter was given, the addtl parameter was also required.
 expm1This function is now available on all platforms
 fgetcsvThe escape parameter was added
 func_get_argIf this function is called from the outermost scope of a file which has been included by calling include or require from within a function in the calling file, it now generates a warning and returns FALSE.
 func_get_argThis function can now be used in parameter lists.
 func_get_argsThis function can now be used in parameter lists.
 func_get_argsIf this function is called from the outermost scope of a file which has been included by calling include or require from within a function in the calling file, it now generates a warning and returns FALSE.
 func_num_argsIf this function is called from the outermost scope of a file which has been included by calling include or require from within a function in the calling file, it now generates a warning and returns -1.
 func_num_argsThis function can now be used in parameter lists.
 get_object_varsThis function now returns NULL if the object isn't an object.
 getimagesizeAdded icon support.
 getmxrrThis function is now available on Windows platforms.
 imagefilterPixelation support (IMG_FILTER_PIXELATE) was added.
 inet_ntopThis function is now available on Windows platforms.
 inet_ptonThis function is now available on Windows platforms.
 json_decodeAdded the optional depth. The default recursion depth was increased from 128 to 512
 json_encode增加 options 参数.
 linkThis function is now available on Windows platforms (Vista, Server 2008 or greater).
 linkinfoThis function is now available on Windows platforms (Vista, Server 2008 or greater).
 log1pThis function is now available on all platforms
 mb_get_infoThe entry "http_output_conv_mimetypes" was made available.
 mcrypt_create_ivIt is no longer required to call srand first. This is now done automatically.
 mcrypt_create_ivMCRYPT_DEV_RANDOM and MCRYPT_DEV_URANDOM became available on Windows platforms.
 mktimemktime now throws E_DEPRECATED notice if the is_dst parameter is used.
 parse_ini_fileAdded optional scanner_mode parameter. Single quotes may now be used around variable assignments. Hash marks (#) may no longer be used as comments and will throw a deprecation warning if used.
 pg_lo_importThe optional object_id was added.
 property_existsThis function checks the existence of a property independent of accessibility.
 rawurlencodeNow conforms to RFC 3986.
 readlinkThis function is now available on Windows platforms (Vista, Server 2008 or greater).
 register_tick_functionTicks are now supported on threaded web server modules.
 session_startIf a session fails to start, then FALSE is returned. Previously TRUE was returned.
 shm_attachThis function now returns a 资源(resource) instead of an integer.
 socket_create_pairThis function is now re-enabled on Windows platforms.
 stream_context_createAdded the optional params argument.
 stream_socket_pairThis function is now available on Windows platforms.
 strtotimePrior to PHP 5.3.0, 24:00 was not a valid format and strtotime returned FALSE.
 sybase_connectThe new parameter was added.
 symlinkThis function is now available on Windows platforms (Vista, Server 2008 or greater).
 touchIt became possible to change the modification time of a directory under Windows.
 ReflectionFunction::__constructname can now be a closure.
5.2.10ip2longPrior to this version, ip2long would sometimes return a valid number even if passed an value which was not an (IPv4) Internet Protocol dotted address.
5.2.8XSLTProcessor::importStylesheetAccepts SimpleXMLElement again which was broken since PHP 5.2.6.
5.2.7parse_ini_fileOn syntax error this function will return FALSE rather than an empty array.
 strtotimeIn PHP 5 prior to 5.2.7, requesting a given occurrence of a given weekday in a month where that weekday was the first day of the month would incorrectly add one week to the returned timestamp. This has been corrected in 5.2.7 and later versions.
5.2.6fopenThe 'c' and 'c+' options were added
5.2.5imagefilterAlpha support for IMG_FILTER_COLORIZE was added.
5.2.4checkdnsrrTXT type was added.
 ldap_first_attributeThe ber_identifier was removed. This is now handled automatically by PHP.
 ldap_next_attributeThe ber_identifier was removed. This is now handled automatically by PHP.
 parse_ini_fileKeys and section names consisting of numbers are now evaluated as PHP integers thus numbers starting by 0 are evaluated as octals and numbers starting by 0x are evaluated as hexadecimals.
5.2.3getimagesizeRead errors generated by this function downgraded to E_NOTICE from E_WARNING.
 json_decodeThe nesting limit was increased from 20 to 128
 XMLWriter::writeElementThe content parameter became optional.
 XMLWriter::writeElementNSThe content parameter became optional.
 PDOStatement::getColumnMetatable field
5.2.2DOMDocument::registerNodeClassPrior to 5.2.2, a previously registered extendedclass had to be unregistered before being able to register a new class extending the same baseclass.
 ftp_ssl_connectThe function was changed to return FALSE when it can't use an SSL connection, instead of fallbacking to a non-SSL one as previously.
 proc_terminatePrevious versions used to destroy the given process resource.
 token_get_allLine numbers are returned in element 2
5.2.1json_decodeAdded support for JSON decoding of basic types.
 proc_openAdded the bypass_shell option to the other_options parameter.
5.2.0base64_decodestrict added
 imagettftextIt is now possible to specify an hexadecimal entity in text.
 imap_openn_retries added
 imap_reopenn_retries added
 mb_strrposAdded the optional parameter offset.
 openssl_verifyThe signature_alg parameter was added.
 pathinfoThe PATHINFO_FILENAME constant was added.
 session_get_cookie_paramsThe "httponly" entry was added in the returned array.
 session_set_cookie_paramsThe httponly parameter was added.
 setcookieThe httponly parameter was added.
 setrawcookieThe httponly parameter was added.
 snmp_set_oid_numeric_printSince PHP 5.2.0.
 PDOStatement::executeThe keys from input_parameters must match the ones declared in the SQL. Before PHP 5.2.0 this was silently ignored.
 SimpleXMLElement::childrenThe optional parameter is_prefix was added.
 SoapServer::SoapServerAdded the typemap option.
 SWFMovie::streamMP3skip added
 XMLReader::openencoding and options were added.
 XMLReader::XMLencoding and options were added.
5.1.3get_headersThis function now uses the default stream context, which can be set/changed with the stream_context_set_default function.
 mb_get_infoThe entries "mail_charset", "mail_header_encoding", and "mail_body_encoding" were made available.
 SoapClient::__doRequestThe one_way parameter was added.
 XMLReader::getAttributeReturn NULL if no attribute found. Previously, returned an empty string.
5.1.2date_default_timezone_set本版本开始验证 timezone_identifier 参数。
 parse_urlAdded the component parameter.
5.1.1dateThere are useful constants of standard date/time formats that can be used to specify the format parameter.
5.1.0DOMDocument::saveAdded the options parameter
 DOMDocument::saveXMLAdded the options parameter
 ctype_digitBefore PHP 5.1.0, this function returned TRUE when text was an empty string.
 dateThe valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). However, before PHP 5.1.0 this range was limited from 01-01-1970 to 19-01-2038 on some systems (e.g. Windows).
 date现在发布 E_STRICT 和 E_NOTICE 时区错误。
 date_sunrise现在发布 E_STRICT 和 E_NOTICE 时区错误。
 date_sunset现在发布 E_STRICT 和 E_NOTICE 时区错误。
 file_get_contentsAdded the offset and maxlen parameters.
 file_put_contents添加了对 LOCK_EX 的支持和 data 参数处理 stream 资源的功能。
 gettimeofdayThe return_float parameter was added.
 globGLOB_ERR was added
 imagerotateignore_transparent was added.
 localtime现在发布 E_STRICT 和 E_NOTICE 时区错误。
 mktimeis_dst 参数被废弃。出错时函数返回 FALSE 而不再是 -1。修正了本函数可以接受年月日参数全为零。
 mktimeThe is_dst parameter became deprecated. Made the function return FALSE on error, instead of -1. Fixed the function to accept the year, month and day to be all passed as zero.
 mktime现在发布 E_STRICT 和 E_NOTICE 时区错误。
 mktimeWhen called with no arguments, mktime throws E_STRICT notice. Use the time function instead.
 openssl_pkcs7_verifyThe content parameter was added.
 session_regenerate_idAdded the delete_old_session parameter.
 sqlite_execAdded the error_msg parameter
 sqlite_fetch_column_typesAdded result_type
 sqlite_queryAdded the error_msg parameter
 sqlite_unbuffered_queryAdded the error_msg parameter
 stream_copy_to_streamAdded the offset parameter
 stream_filter_appendPrior to PHP 5.1.0, this function returns TRUE on success 或者在失败时返回 FALSE.
 stream_filter_prependPrior to PHP 5.1.0, this function returns TRUE on success 或者在失败时返回 FALSE.
 stream_get_contentsThe offset was added.
 strftime现在发布 E_STRICT 和 E_NOTICE 时区错误。
 strtotime现在发布 E_STRICT 和 E_NOTICE 时区错误。
 strtotime失败时返回 FALSE,不再是 -1。
 strtotimeNow returns FALSE on failure, instead of -1.
 XSLTProcessor::registerPHPFunctionsThe restrict parameter was added.
5.0.4sqlite_keyPrior to PHP 5.0.4, sqlite_key was only able to be called as a method on a SQLiteResult object, not procedurally.
5.0.3get_class_varsDepending on the scope, get_class_vars will only return the properties that can be accessed from the current scope.
 is_subclass_ofYou may also specify the object parameter as a string (the name of the class)
5.0.2class_existsNo longer returns TRUE for defined interfaces. Use interface_exists.
 get_class_varsCalling get_class_vars will now expose all the properties as an array, unlike previous behaviour where protected and private properties were prefixed with nul bytes.
 strtotimeIn PHP 5 up to 5.0.2, "now" and other relative times are wrongly computed from today's midnight. This differs from other versions where it is correctly computed from current time.
5.0.1get_class_varsCalling get_class_vars will expose all properties, as when converting an object to a class.
5.0.0apache_get_modulesBecame available when using Apache 1, or the PHP Apache 2 filter API. Before this time, it was only available when using the Apache 2 handler API.
 apache_get_versionBecame available with the Apache 2 filter API.
 checkdnsrrAAAA type was added.
 class_existsThe autoload parameter was added.
 emptyObjects with no properties are no longer considered empty.
 fgetssThe length parameter is optional
 fileThe context parameter was added
 filePrior to PHP 5.0.0 the flags parameter only covered include_path and was enabled with 1
 file_get_contentsAdded context support.
 get_class_methodsAs of PHP 5, this function returns the name of the methods as they were declared (case-sensitive). In PHP 4 they were lowercased.
 ip2longPrior to this version, ip2long returned -1 on failure.
 is_executableis_executable became available with Windows
 mb_encode_mimeheaderThe indent parameter was added.
 mb_send_mailThe Content-Type and Content-Transfer-Encoding headers may be redefined as of PHP 5.0.0. Before this time, the values defined by mb_language are always used.
 mkdirThe recursive parameter was added
 mkdirAs of PHP 5.0.0 mkdir can also be used with some URL wrappers. Refer to for a listing of which wrappers support mkdir
 mysql_fetch_objectAdded the ability to return as a different object.
 opendirpath 支持 ftp:// URL wrapper
 openssl_pkcs7_encryptThe cipherid parameter was added.
 openssl_signThe signature_alg parameter was added.
 parse_ini_fileValues enclosed in double quotes can contain new lines.
 proc_openAdded the cwd, env and other_options parameters.
 renamerename can now also be used with some URL wrappers. Refer to for a listing of which wrappers support rename.
 rmdirAs of PHP 5.0.0 rmdir can also be used with some URL wrappers. Refer to for a listing of which wrappers support rmdir.
 session_idThe , (comma) and - (minus) characters are allowed in the file session handler.
 socket_createThe AF_INET6 constant was added.
 strtotimeMicroseconds began to be allowed, but they are ignored.
 unlinkAs of PHP 5.0.0 unlink can also be used with some URL wrappers. Refer to for a listing of which wrappers support unlink.

附录
PHP 手册