is_int

  • We can check if a variable is an integer in Ruby using Object#is_a?.

    PHP

    $number = 2;
    $result = is_float($number);
    var_export($result);
    // => true

    Ruby

    number = 2
    p number.is_a?(Integer)
    # => true

    see also

Looking for Rails or PHP web application development, integration, and training?

Rails for PHP is brought to you by Maintainable Software. Get custom web applications and personalized training from the authors of the book and website.