function unparse_url( $parsed_url , $ommit = array( ) )
//From Open Web Analytics owa_lib.php
$url = '';
$p = array();
$p['scheme'] = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : '';
$p['host'] = isset( $parsed_url['host'] ) ? $parsed_url['host'] : '';
$p['port'] = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : '';
$p['user'] = isset( $parsed_url['user'] ) ? $parsed_url['user'] : '';
$p['pass'] = isset( $parsed_url['pass'] ) ? ':' . $parsed_url['pass'] : '';
$p['pass'] = ( $p['user'] || $p['pass'] ) ? $p['pass']."@" : '';
$p['path'] = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '';
$p['query'] = isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '';
$p['fragment'] = isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : '';
if ( $ommit )
foreach ( $ommit as $key )
if ( isset( $p[ $key ] ) )
$p[ $key ] = '';
Its easy to get domain name or host from a URL using the builtin PHP function
parse_url that can help you extract the domain name or other components of a given URL.
This library lists
apc_* family of functions for eAccelerator, xCache or Disk Cache operations if APC or APCu is not available on server. When APC is installed and enabled, this library does nothing (because the desired functions are already available) – resulting in zero wrapper call overhead since all calls go directly to internal APC api.
When working with arrays in PHP, you may often need to check whether each of an array’s element contains scalar data or is there an element that contains another array (a sub-array). In other words, what you want is to check if the array multidimensional? To solve the mystery, many people quote a buggy snippet on stackoverflow and other programming websites. Reading through such pages, I decided to explain a bug in the most commonly used method of checking multidimensional arrays, and also to provide the right solution.
PHP provides some handy functions for file and directory handling, but to deal with nested directories, it does not provide much. There are basic directory functions and a directory iterator, but does not cover directory level operations like moving, cloning, counting files, deleting etc.
Portable UTF-8 library is a Unicode aware alternative to PHP’s native string handling API. It is written in PHP and can work without
iconv, UTF-8 support in PCRE, or any other library. The benefit of Portable UTF-8 is that it is very light-weight, fast, easy to use, easy to bundle, and it always works (no dependencies).
When the php.ini directive
auto_globals_jit is enabled,
$_ENV super global arrays are created at the time they are first used in the script, rather than being initialized at the start of script. The benefit of this directive is that these super global arrays are not created at all if not used within a script, resulting in a little performance gain.