New Functions

PHP 5.2.x introduced some new functions:

PHP Core:

  • array_fill_keys - Create an array using the elements of the first parameter as keys, each initialized to val
  • error_get_last - Get the last occurred error as associative array. Returns NULL if there hasn't been an error yet
  • image_type_to_extension - Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
  • memory_get_peak_usage - Returns the peak allocated by PHP memory
  • sys_get_temp_dir - Returns directory path used for temporary files. (Added in 5.2.1)
  • timezone_abbreviations_list - Returns associative array containing DST, offset and the timezone name
  • timezone_identifiers_list - Returns numerically indexed array with all timezone identifiers
  • timezone_name_from_abbr - Returns the timezone name from abbreviation
  • stream_socket_shutdown - Causes all or part of a full-duplex connection on the socket associated with stream to be shut down. As of PHP 5.2.1.

Image:

  • imagegrabscreen - Grabs a screenshot of the whole screen. As of PHP 5.2.2.
  • imagegrabwindow - Captures a window. As of PHP 5.2.2.

libXML:

  • libxml_disable_entity_loader - Disable the ability to load external entities. As of PHP 5.2.11.

mbstring:

  • mb_stripos - Finds position of first occurrence of a string within another, case insensitive
  • mb_stristr - Finds first occurrence of a string within another, case insensitive
  • mb_strrchr - Finds the last occurrence of a character in a string within another
  • mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive
  • mb_strripos - Finds position of last occurrence of a string within another, case insensitive
  • mb_strstr - Finds first occurrence of a string within another

ming (As of PHP 5.2.1):

  • void ming_setSWFCompression(int num) - Sets output compression
  • void swfmovie::namedanchor(string name) - Creates anchor
  • void swfmovie::protect([string password]) - Protects

openssl:

  • openssl_csr_get_public_key - Extracts public key from a CERT and prepares it for use
  • openssl_csr_get_subject - Returns the subject of a CERT
  • openssl_pkey_get_details - Returns an array with the key details (bits, pkey, type)

spl:

  • spl_object_hash - Return hash id for given object
  • int iterator_apply(Traversable it, mixed function [, mixed params]) - Calls a function for every element in an iterator

pcre:

  • preg_last_error - Returns the error code of the last regex execution

pgsql:

  • pg_field_table - Returns the name of the table field belongs to, or table's oid if oid_only is TRUE

posix:

  • posix_initgroups - Calculate the group access list for the user specified in name

gmp:

  • gmp_nextprime - Finds next prime number

xmlwriter:

  • xmlwriter_full_end_element - End current element - returns FALSE on error
  • xmlwriter_write_raw - Write text - returns FALSE on error
  • xmlwriter_start_dtd_entity - Create start DTD Entity - returns FALSE on error
  • xmlwriter_end_dtd_entity - End current DTD Entity - returns FALSE on error
  • xmlwriter_write_dtd_entity - Write full DTD Entity tag - returns FALSE on error