我正在编写一些代码,但有点烦恼的是PHP有时使用下划线调用函数,而有时则作为一个单词。这是怎么回事?
例如:
int strlen(string $str)
和
bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )
我希望有一个合理的解释,并想知道其中的原因。
我正在编写一些代码,但有点烦恼的是PHP有时使用下划线调用函数,而有时则作为一个单词。这是怎么回事?
例如:
int strlen(string $str)
和
bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )
我希望有一个合理的解释,并想知道其中的原因。
PHP函数命名不一致
在下划线(_)与无下划线之间没有明显的系统:
underscore no underscore:
stream_get_line readline
disk_free_space diskfreespace
is_object isset
mcal_day_of_week jddayofweek
set_error_handler setlocale
snmp_get_quick_print snmpget
get_browser getallheaders
base64_encode urlencode
image_type_to_mime_type imagetypes
msql_num_fields mysql_numfields
php_uname phpversion
strip_tags stripslashes
bind_textdomain_codeset bindtextdomain
cal_to_jd gregoriantojd
str_rot13 strpos
(mixed $needle , array $haystack)
然后
(array $haystack , string $needle)
所以要么适应它,要么离开,这就是座右铭。
implode(string $glue, array $pieces)
和implode(array $pieces, string $glue)
怎么样? ;) - binaryLV