PHP to Ruby
Convert PHP code into Ruby!
-
array_push
Posted on July 20th, 2009 No commentsThe array_push() function pushes elements onto the end of an array (acting in the opposite way to array_pop).
PHP
$programming = array('java', 'ruby', 'python', 'php'); array_push($programming, 'asp'); print_r($programming); => /* Array ( [0] => java [1] => ruby [2] => python [3] => php [4] => asp ) */
Ruby
programming = ['java', 'ruby', 'python', 'php']; programming.push('asp'); => # ["java", "ruby", "python", "php", "asp"]
Leave a reply


