# PHP 5.1 Beta 2

Published: 2005-06-23

<p>Ok, so maybe I've been living under a rock for too long, but <a href="http://www.php.net/">PHP</a> <a href="http://www.php.net/downloads.php#v5.1">5.1</a> is almost here :D and with it a lot of new stuff :D, including several changes to <a href="http://www.php.net/manual/en/ref.mysqli.php">MySQLi</a>, <a href="http://www.php.net/manual/en/ref.spl.php">SPL</a>, etc. It's very nice to see SPL groing up and it's certanly time to wake up and start using it , and I promissed myself I would , Interfaces are our friends :D</p>
<p>Here are the Added things, from Beta 1 and Beta 2:</p>
<p>
<b>Beta 2</b></p>
<ul>
<li>Improved PHP extension loading mechanism with support for module dependencies and conflicts. (Jani, Dmitry) </li>
<li>Allowed return by reference from internal functions. (Marcus, Andi, Dmitry)</li>
<li>Rewrote strtotime() with support for timezones and many new formats.  Implements feature requests #21399, #26694, #28088, #29150, #29585 and  #29595. (Derick)</li>
<li>Added bindto socket context option. (Ilia)</li>
<li>Added offset parameter to the stream_copy_to_stream() function. (Ilia)</li>
<li>Added offset & length parameters to substr_count() function. (Ilia)</li>
</ul>
<p><b>Beta 1</b></p>
<ul>
<li>Upgraded PCRE library to version 5.0. (Andrei)</li>
<li>Removed php_check_syntax() function which never worked properly. (Ilia)</li>
<li>Removed garbage manager in Zend Engine which results in more aggressive freeing of data. (Dmitry, Andi)</li>
<li>Moved extensions to PECL:
<ul>
<li>ext/cpdf        (Tony, Derick)</li>
<li>ext/dio         (Jani, Derick)</li>
<li>ext/fam         (Jani, Derick)</li>
<li>ext/ingres_ii   (Jani, Derick)</li>
<li>ext/mnogosearch (Jani, Derick)</li>
<li>ext/w32api      (Jani, Derick)</li>
<li>ext/yp          (Jani, Derick)</li>
</ul>
</li>
<li>Changed sha1_file() and md5_file() functions to use streams instead of low level IO. (Uwe)</li>
<li>Changed abstract private methods to be not allowed anymore. (Stas)</li>
<li>Changed stream_filter_(ap|pre)pend() to return resource. (Sara)</li>
<li>Changed mysqli_exception and sqlite_exception to use RuntimeException as base if SPL extension is present. (Georg, Marcus)</li>
<li>Improved interactive mode of PHP CLI (php -a). (Johannes, Marcus)</li>
<li>Improved performance of:
<ul>
<li>general execution/compilation. (Andi, Thies, Sterling, Dmitry, Marcus)</li>
<li>switch() statement. (Dmitry)</li>
<li>several array functions. (Marcus)</li>
<li>virtual path handling by adding a realpath() cache. (Andi)</li>
<li>variable fetches. (Andi)</li>
<li>magic method invocations. (Marcus)</li>
</ul>
</li>
<li>Improved support for embedded server in mysqli. (Georg)</li>
<li>Improved mysqli extension. (Georg)
<ul>
<li>added constructor for mysqli_stmt and mysqli_result classes</li>
<li>added new function mysqli_get_charset()</li>
<li>added new function mysqli_set_charset()</li>
<li>added new class mysqli_driver</li>
<li>added new class mysqli_warning</li>
<li>added new class mysqli_execption </li>
<li>added new class mysqli_sql_exception</li>
</ul>
</li>
<li>Improved SPL extension. (Marcus)
<ul>
<li>added standard hierarchy of Exception classes</li>
<li>added interface Countable</li>
<li>added interfaces Subject and Observer</li>
<li>added spl_autoload*() functions</li>
<li>converted several 5.0 examples into c code</li>
<li>added class FileObject</li>
<li>added possibility to use a string with class_parents() and class_implements(). (Andrey)</li>
</ul>
</li>
<li>Added man pages for "phpize" and "php-config" scripts. (Jakub Vrana)</li>
<li>Added support for .cc files in extensions. (Brian)</li>
<li>Added PHP_INT_MAX and PHP_INT_SIZE as predefined constants. (Andrey)</li>
<li>Added user opcode API that allow overloading of opcode handlers. (Dmitry)</li>
<li>Added an optional remove old session parameter to session_regenerate_id(). (Ilia)</li>
<li>Added array type hinting. (Dmitry)</li>
<li>Added the tidy_get_opt_doc() function to return documentation for configuration options in tidy. (Patch by: nlopess@php.net)</li>
<li>Added support for .cc files in extensions. (Brian)</li>
<li>Added imageconvolution() function which can be used to apply a custom 3x3 matrix convolution to an image. (Pierre)</li>
<li>Added optional first parameter to XsltProcessor::registerPHPFunctions to only allow certain functions to be called from XSLT. (Christian)</li>
<li>Added the ability to override the autotools executables used by the buildconf  script via the PHP_AUTOCONF and PHP_AUTOHEADER environmental variables. (Jon)</li>
<li>Added several new functions to support the PostgreSQL v3 protocol introduced  in PostgreSQL 7.4. (Christopher)
<ul>
<li>pg_transaction_status() - in-transaction status of a database connection.</li>
<li>pg_query_params() - execution of parameterized queries.</li>
<li>pg_prepare() - prepare named queries.</li>
<li>pg_execute() - execution of named prepared queries.</li>
<li>pg_send_query_params() - async equivalent of pg_query_params().</li>
<li>pg_send_prepare() - async equivalent of pg_prepare().</li>
<li>pg_send_execute() - async equivalent of pg_execute().</li>
<li>pg_result_error_field() - highly detailed error information, most importantly the SQLSTATE error code.</li>
<li>pg_set_error_verbosity() - set verbosity of errors.</li>
</ul>
</li>
<li>Added optional fifth parameter "count" to preg_replace_callback() and  preg_replace() to count the number of replacements made. FR #32275. (Andrey)</li>
<li>Added optional third parameter "charlist" to str_word_count() which  contains characters to be considered as word part. FR #31560. (Andrey, Ilia)</li>
<li>Added interface Serializeable. (Stanislav, Marcus)</li>
<li>Added pg_field_type_oid() PostgreSQL function. (mauroi at digbang dot com)</li>
<li>Added zend_declare_property_...() and zend_update_property_...()</li>
<li>API functions for bool, double and binary safe strings. (Hartmut)</li>
<li>Added possibility to access INI variables from within .ini file. (Andrei)</li>
<li>Added variable $_SERVER['REQUEST_TIME'] containing request start time. (Ilia)</li>
<li>Added optional float parameter to gettimeofday(). (Ilia)</li>
<li>Added apache_reset_timeout() Apache1 function. (Rasmus)</li>
<li>Added sqlite_fetch_column_types() 3rd argument for arrays. (Ilia)</li>
<li>Added optional offset parameter to stream_get_contents() and  file_get_contents(). (Ilia)</li>
<li>Added optional maxlen parameter to file_get_contents(). (Ilia)</li>
<li>Added SAPI hook to get the current request time. (Rasmus)</li>
<li>Added new functions:
<ul>
<li>array_diff_key() (Andrey)</li>
<li>array_diff_ukey() (Andrey)</li>
<li>array_intersect_key() (Christiano Duarte)</li>
<li>array_intersect_ukey() (Christiano Duarte)</li>
<li>array_product() (Andrey)</li>
<li>DomDocumentFragment::appendXML() (Christian)</li>
<li>fputcsv() (David Sklar)</li>
<li>htmlspecialchars_decode() (Ilia)</li>
<li>inet_pton() (Sara)</li>
<li>inet_ntop() (Sara)</li>
<li>mysqli::client_info property (Georg)</li>
<li>posix_access() (Magnus)</li>
<li>posix_mknod() (Magnus)</li>
<li>SimpleXMLElement::registerXPathNamespace() (Christian)</li>
<li>stream_context_get_default() (Wez)</li>
<li>stream_socket_enable_crypto() (Wez)</li>
<li>stream_wrapper_unregister() (Sara)</li>
<li>stream_wrapper_restore() (Sara)</li>
<li>stream_filter_remove() (Sara)</li>
<li>time_sleep_until() (Ilia)</li>
</ul>
</li>
<li>Added DomDocument::$recover property for parsing not well-formed  XML Documents. (Christian)</li>
<li>Added Cursor support for MySQL 5.0.x in mysqli (Georg)</li>
<li>Added proxy support to ftp wrapper via http. (Sara)</li>
<li>Added MDTM support to ftp_url_stat. (Sara)</li>
<li>Added zlib stream filter support. (Sara)</li>
<li>Added bz2 stream filter support. (Sara)</li>
<li>Added HTTP/1.1 and chunked encoding support to http:// wrapper. (Sara)</li>
<li>Added max_redirects context option that specifies how many HTTP redirects to follow. (Ilia)</li>
<li>Added support of parameter=>value arrays to xsl_xsltprocessor_set_parameter().  (Tony)</li>
</ul>
