PHP to Ruby
Convert PHP code into Ruby!
-
count
Posted on April 11th, 2009 No commentsReturns the number of elements in an array.
PHP
$a = array('first' => 1, 'second' => 2); echo count($a); // => 2
Ruby
my_array = [1, 2]; puts my_array.length; # => 2
-
sizeof
Posted on March 5th, 2009 No commentsThe sizeof() function is only an alias of count, which returns the number of elements in an array.
For further information about sizeof(), see count().


