Tag : php

Ruby vs. PHP (Intro)

Written by Ken Nordquist on March 30, 2012

One of the key differences in the languages (Ruby vs. PHP) is the level of “object-orientation,” and (obviously) syntax. Ruby was designed from the start (~1993) to be an object-oriented (OO) language (EVERYTHING is an object) while PHP was, until recently (v5.0 – 2004), a procedural language. As a long-time PHP programmer who migrated to Ruby in 2006, I prefer Ruby’s implementation of Types and Objects over PHP's. I also prefer Ruby’s syntax AND coding best-practices over PHP’s.

Why is "Everything is an Object" in Ruby and not PHP?  (I know those of you who are ...

Short url : http://bit.ly/HzunT6

Parameter Order in PHP's Built-In Functions

Written by Ken Nordquist on May 19, 2011

There does seem to be a "method to the madness" in the parameter order of PHP's built-in functions. 

For array functions the order is (needle, haystack).

For string functions, the order is (haystack, needle).


Array Function Example (needle, haystack):

array_key_exists( mixed $key , array $search )


String Function Example (haystack, needle):

stripos ( string $haystack , string $needle [, int $offset = 0 ] )

Short url : http://bit.ly/jRM19q