There are a number of functions that have bugs / weird interfaces / security issues etc. which do you think is worst?
Personally, a function that should -logically1- return a useful value, variable (etc) but instead returns a boolean (to indicate success or failure) is amongst the most annoying functions. My own example of this is:
$array = array("apples","oranges","bananas","plums");
$shuffled_array = shuffle($array);
echo "$shuffled_array"; // echoes the value "1"
I don't know about other people but, for me (and this is perhaps a fault with my own understanding of the underlying science, philosophy...whatever), this should return a shuffle()
-ed array.
1: Obviously for a very subjective value of 'logically.'
All of the array functions that can't seem to get the needle/haystack order implemented similarly.
All of the string functions that can't decide whether to use an underscore between words or not. strip_tags() and stripslashes()
Personally, I hate the fact that some functions do not have the same parameters order... For example:
http://us2.php.net/manual/en/function.in-array.php
AND
http://us3.php.net/manual/en/function.stristr.php
In both you specify $haystack
and $needle
, but in different orders. I hate when those are swapped from function to function.
I hate min
and max
. I can never remember what they do. Min and max what?! Why not use some kind of useful name, like smallest_value_in_the_following_list()
and biggest_element_in_this_array_or_set_of_parameters()
. Stupid PHP.
Oh and don't even get me started on rand()
. Nearly everytime I call it I get a different answer.
get_magic_quotes_gpc()
... PHP should have never used magic quotes.
I don't like strpos.
"Find position of first occurrence of a string"... "Returns the position as an integer."
e.g. if the first character, returns 0, second, returns 1, etc.
however unlike Java, Javascript or many other languages... if it isn't found, it doesn't return an integer e.g. -1, it returns a boolean FALSE instead.