protected function substrCount($haystack, $needle, $offset, $length)
    {
        static $oldVersion;
        if ($oldVersion === null) {
            $oldVersion = version_compare(PHP_VERSION, '5.1', '<');
        }
        if ($oldVersion) {
            $haystack = substr($haystack, $offset, $length);
            return substr_count($haystack, $needle);
        } else {
            return substr_count($haystack, $needle, $offset, $length);
        }
    }
protected function substrCount($haystack, $needle, $offset, $length)
    {
        static $oldVersion;
        if ($oldVersion === null) {
            $oldVersion = version_compare(PHP_VERSION, '5.1', '<');
        }
        if ($oldVersion) {
            $haystack = substr($haystack, $offset, $length);
            return substr_count($haystack, $needle);
        } else {
            return substr_count($haystack, $needle, $offset, $length);
        }
    }
protected function substrCount ( $ haystack , $ needle , $ offset , $ length ) { static $ oldVersion ; if ( $ oldVersion === null ) { $ oldVersion = version_compare ( PHP_VERSION , '5.1' , '<' ) ; } if ( $ oldVersion ) { $ haystack = substr ( $ haystack , $ offset , $ length ) ; return substr_count ( $ haystack , $ needle ) ; } else { return substr_count ( $ haystack , $ needle , $ offset , $ length ) ; } }
PHP 5.0.x compatible substr_count that implements offset and length
@param string $haystack
@param string $needle
@param int $offset
@param int $length
@return int
PHP 5 . 0 . x compatible substr_count that implements offset and length