strlen

  • We can find the length of a string in Ruby using the String#length method.

    PHP

    print strlen('hello world');
    // => 11

    Ruby

    puts "hello world".length
    # => 11

    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.