More PHP Illogic

Blog Subjects: 

You may remember this post about why PHP kind of sucks.

I came across another example of its illogical and inconsistent API.

$colors = [ 'blue', 'green' ];

array_push( $colors, 'red' ); // adds red to array

in_array( 'red', $colors ); // returns TRUE

Someone please explain why in array_push() the array comes first, but in in_array() the array comes last?

It's this kind of stuff that makes programming in PHP more time-consuming and unpleasant than working in Python or JavaScript.

© 2010 Your Name.. Drupal theme by Kiwi Themes.