Re: PHP global namespace clogged up

From: Daniel Tryba (news_comp.lang.php_at_canopus.nl)
Date: 09/02/04


Date: Thu, 2 Sep 2004 12:58:38 +0000 (UTC)

Tony Marston <tony@nospam.demon.co.uk> wrote:
>>> I have groundbreaking news for all you geeks - PHP is not the same as
>>> language X because IT IS DIFFERENT. If it was the same then there would
>>> be
>>> no point. Different languages are different, so get used to the
>>> differences
>>> and STOP COMPLAINING.
>>
>> I'm pointing out a serious problem with PHP.
>
> If PHP had serious problems it would not be the popular language it is
> today. If any problems exist at all they are in your head.
 
While PHP doens't need a namespace, its functions are a _mess_
Examples:

-str_split() vs parse_str()
 The latter obviously should be str_parse()

-str* vs. str_*
 Lets make up our minds an use uniform function names please.

-strchr() is an alias for strstr(), strrchr() is not an alias for
 strrstr() (which doesn't even exist).

-string strchr(string haystack, string needle)
 shouldn't that be char needle?

-strpos vs strrpos
 int strpos(string haystack, string needel [,int offset]):
    this function can take a full string as the needle parameter and the
    entire string will be used.
 int strrpos ( string haystack, string needle [, int offset]):
     If a string is passed as the needle, then only the first character
     of that string will be used
 So strrpos not only works differently, it's prototype should be
 int strrpos ( string haystack, char needle [, int offset])

All exmaples above use the haystack-needle form, others use
needle-haystack order (like array_key_exists).

It appears you are blind to these faults or are just used to it! Maybe
you are using some piece of software to correct there errors for you?

-- 
  Daniel Tryba


Relevant Pages

  • Re: Implementing strstr
    ... that string doesn't appear at all). ... const char* strstr(const char* haystack, const char* needle) ...
    (comp.programming)
  • RE: Currency Field Format Correction
    ... Function SF_removeAllOnce(ByVal Haystack As String, ByVal Needle As String) ... Fieldname]) and run the query. ...
    (microsoft.public.access.modulesdaovba)
  • RE: [PHP] odd behavior of stripos() with === operator *LAST POST*
    ... In a situation where you are only dealing with boolean values, ... int stripos (string haystack, string needle ) ... you the position of the needle in your haystack, ...
    (php.general)
  • Documentation on strpos
    ... "Returns the numeric position of the first occurrence of needle in the ... full string as the needle parameter and the entire string will be used." ... I find the reference to "strrpos" confusing, ... haystack string." ...
    (comp.lang.php)
  • Re: divide & conquer algorithm to implement string matching
    ... a string like "01101011001100110110".Does anybody has any idea? ... unsigned char needle = 0x6; ... int i = 0; ...
    (comp.programming)