printf

  • Outputting a formatted string works nearly identical in Ruby using printf.

    PHP

    printf("The %s is %d feet tall", "man", 6);
    // => The man is 6 feet tall

    Ruby

    printf("The %s is %d feet tall", "man", 6)
    # => The man is 6 feet tall

    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.