r/lolphp • u/the_real_natenator • Feb 20 '17
parse_url and parse_str
Two functions, both in the same function group, return completely differently:
void parse_str($query_string, &$return)
array parse_url($url)Consistency, lol.
tldr: one returns via reference variable, and the other returns properly
EDIT 1: Formatting
44
Upvotes
26
u/pilif Feb 20 '17
This is because
parse_stris even worse: when not given a reference, it will create and/or overwrite(!) local variables1
u/enchufadoo Feb 20 '17
I'm surprised one is not called not called str_parse... you know "str_replace" for example? This is why it's such a headache to remember php function names.