ucfirst

  • Capitalizing the first character in a string is done in Ruby using the String#capitalize method.

    PHP

    print ucfirst("hello world");
    // => Hello world

    Ruby

    puts "hello world".capitalize
    # => Hello world

    see also

trim ucwords

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.