Convert PHP code into Ruby!
RSS icon Email icon Home icon
  • array_pop

    Posted on July 17th, 2009 RubyLove No comments

    The array_pop() function removes the element off the end of an array and returns it’s value.

    PHP

    $my_array = array('java', 'ruby', 'python', 'php');
    echo array_pop($my_array);
    => // php

    Ruby

    my_array = ['java', 'ruby', 'python', 'php'];
    puts my_array.pop
    => # php