Location: PHPKode > scripts > Brim::QuickSort > brim-quicksort/PhpCompatibility.php
<?php
/**
 * Global static function
 *
 * This file is part of the Brim project.
 * The brim-project is located at the following 
 * location: {@link http://www.brim-project.org/ http://www.brim-project.org/}
 * 
 * <pre> Enjoy :-) </pre>
 *
 * @author Michael Haussmann 
 * @package org.brim-project.framework
 * @subpackage util
 *
 *
 * @copyright Michael Haussmann
 *
 * @license http://opensource.org/licenses/gpl-license.php 
 * The GNU Public License
 */

/**
 * Posted at php.net. The function substr_compare is a PHP5 function
 * by sleek
 */
if (!function_exists('substr_compare'))
{
	function substr_compare($main_str, $str, $offset, $length = NULL, $case_insensitivity = false) 
	{
		$offset = (int) $offset;

		if ($offset >= strlen($main_str)) 
		{
			trigger_error('The start position cannot exceed initial string length.'.$main_str.'-'.$str.'-'.$offset, 
				E_USER_WARNING);
			return;
		}

		if (is_int($length)) 
		{
			$main_substr = substr($main_str, $offset, $length);
		} 
		else 
		{
			$main_substr = substr($main_str, $offset);
		}

		if ($case_insensitivity === true) 
		{
			return strcasecmp($main_substr, $str);
		}

		return strcmp($main_substr, $str);
	}
}
?>
Return current item: Brim::QuickSort