| // +----------------------------------------------------------------------+ // // $Id: stripos.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ // /** * Replace stripos() * * @category PHP * @package PHP_Compat * @link http://php.net/function.stripos * @author Aidan Lister * @version $Revision: 1.1 $ * @since PHP 5 * @require PHP 4.0.1 (trigger_error) */ if (!function_exists('stripos')) { function stripos ($haystack, $needle, $offset = null) { if (!is_scalar($haystack)) { trigger_error('stripos() expects parameter 1 to be string, ' . gettype($haystack) . ' given', E_USER_WARNING); return false; } if (!is_scalar($needle)) { trigger_error('stripos() needle is not a string or an integer.', E_USER_WARNING); return false; } if (!is_null($offset) && !is_numeric($offset)) { trigger_error('stripos() expects parameter 3 to be long, ' . gettype($offset) . ' given', E_USER_WARNING); return false; } // Manipulate the string if there is an offset $fix = 0; if (!is_null($offset)) { if ($offset > 0) { $haystack = substr($haystack, $offset, strlen($haystack) - $offset); $fix = $offset; } } $segments = explode (strtolower($needle), strtolower($haystack), 2); $position = strlen($segments[0]) + $fix; return $position; } } ?>