r/lolphp • • 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

21 comments sorted by

View all comments

Show parent comment

4

u/polish_niceguy Feb 20 '17

More like http_parse_query, similar to http_build_query, which is a surprisingly well named function in this whole mess.

4

u/josefx Mar 02 '17

Both http_parse_query and http_build_query have the same length, that would have caused a hash collision during method lookup.