• String Functions

    Ruby strings are full blown objects. In PHP we typically pass the string we want to modify as an argument to a string function.

    PHP

    $reversed = strrev('my string');

    Ruby instead executes a method on the string object itself.

    Ruby

    reversed = 'my string'.reverse

    This provides a very consistent way of manipulating strings where we are no longer required to remember which function argument is the string we are manipulating.

Table of Contents

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.