Re: [ANNOUNCEMENT] PHP_Compat-1.0.0 (stable) Released.
| From: | Aidan Lister | Date: | Sat, 12 Jun 2004 05:00:33 +0000 |
| Subject: | Re: [ANNOUNCEMENT] PHP_Compat-1.0.0 (stable) Released. | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30537@lists.php.net to get a copy of this message | ||
Hey Klaus,
I fixed the spelling mistake, whoops.
When I brought up adding random useful functions to PHPC, the idea was
smacked down. If you want to bring it up again on the mailing lists we can
see if opinions have changed... I know I have a ton of useful functions to
add.
Specifically regarding the in_array_nocase function. I'd be calling it
in_iarray to be inline with str_ireplace etc. Secondly, is it worth
compromising consistancy for an insanely small difference in speed?
Do you think it would be worth posting to internals@ to have the function
implemented in C?
PHP_FUNCTION(in_iarray)
{
php_search_array(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
}
Then:
static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
+ elseif (behavior == 2) {
etc..
----- Original Message -----
From: "Klaus Guenther" <klaus@capitalfocus.org>
To: "PEAR Announce" <pear-dev@lists.php.net>; "Aidan Lister"
<aidan@php.net>
Sent: Friday, June 11, 2004 10:14 PM
Subject: Re: [PEAR] [ANNOUNCEMENT] PHP_Compat-1.0.0 (stable) Released.
> PEAR Announce wrote:
>
> >The new PEAR package PHP_Compat-1.0.0 (stable) has been released at
http://pear.php.net/.
> >
> >Release notes
> >-------------
> >Added more components:
> >* array_change_key_case
> >* array_chunk
> >* array_diff_assoc
> >* vprintf
> >* vsprintf
> >* var_export
> >
> >Fixed behaviour of stripos/strripos. Searches for whole needle.
> >
> >Package Info
> >-------------
> >PHP_Compat provides missing functionality in the form of Constants and
Functions for older versions of PHP.
> >
> >Constants:
> >* E_STRICT
> >* PATH_SEPERATOR
> >
> >
>
> Ouch... that should be "PATH_SEPARATOR"...
>
> >* STDIN, STDOUT, STDERR
> >* FILE_USE_INCLUDE_PATH, FILE_IGNORE_NEW_LINES, FILE_SKIP_EMPTY_LINES,
FILE_APPEND, FILE_NO_DEFAULT_CONTEXT
> >
> >Functions:
> >* array_change_key_case
> >* array_chunk
> >* array_combine
> >* array_diff_assoc
> >* array_udiff
> >* array_udiff_assoc
> >* file_get_contents
> >* file_put_contents
> >* fprintf
> >* http_build_query
> >* is_a
> >* scandir
> >* str_ireplace
> >* str_split
> >* stripos
> >* strripos
> >* var_export
> >* vprintf
> >* vsprintf
> > Schmidt <schst@php.net> (developer)
> >
> >
>
> One thing I'd love to see in here is a non-existant PHP function...
>
>
> function in_array_nocase($string, $array, $separator = '@#@')
> {
> $arr_str = $separator . strtolower(implode($separator, $array)) .
> $separator;
> $string = $separator . strtolower($string) . $separator;
> if(strpos($arr_str, $string) !== false) {
> return true;
> }
> return false;
> }
>
> It's something that's badly needed since get_class* returns a case
> sensitive array. This is the fastest implementation (see
> http://pixelated-dreams.com/blog/archive/000053.html for
> details).
>
> Klaus
>