What is the assignment and assignment of PHP function names and arguments?

Are the named functions and their arguments randomly ordered in PHP? It’s very difficult for me to remember what function is, and always come to the leadership. What do you do to remember them without turning to the manual every time?

a few examples:
array_map(callback, array) , but array_filter(array, callback) . When working with strings strstr() , strpos() and substr() does not have underscores, but str_replace() , str_pad() and str_split() . and in most cases the string is taken as the first argument, but in explode() string is the second argument.

+4
source share
3 answers

PHP has quite a few inconsistencies in internal functions, just something you need to get used to with - always open functions when you open a link to an encoding.

This is a recognized problem, but insoluble without breaking a huge amount of existing code, i.e. all this, since the affected functions are heavily used for the most part .: - /

+5
source

I am pleased to have the bookmark keyword in firefox http://php.net/%s

That way I can enter the string URL: p function_name , and firefox will automatically open http://php.net/function_name , which is the php function reference guide for the function ...

I disagree with Orbling when he says that the inconsistency problem is insoluble ... new function aliases can be made to reorganize all php functions that can be used in the new code ... for example, with a prefix or some standard way of grouping functions. ..

0
source
  • English is somewhat inconsistent. Sir Bernard Shaw once remarked that a word pronouncing β€œfish” could be written in English as β€œghote”.

  • PHP is grown like any other natural language. With errors, errors and inconsistency.

  • Nobody forbids you to write your own abstraction library with any naming rules and syntax that you choose.

0
source

All Articles