Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

PHP functions and their equivalents in Ruby (and Rails).

Notifications You must be signed in to change notification settings

maintainable/php-ruby-reference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP to Ruby Reference

When learning a new language, it's easy to get hung up on little things. This reference aims to ease the Ruby learning curve for PHP developers by mapping many of the PHP functions to their Ruby (and Rails) equivalents.

Organization

We've attempted to structure the reference as closely to the excellent PHP manual as practical. The directories in this repository map to the sections of the PHP manual.

"Class/Object Information" is named classobj in the PHP manual and can be viewed at http://php.net/classobj. The directory for the source files in this repository is also named classobj.

Within each directory of this repository, there are a collection of Markdown files whose filenames match the names of corresponding PHP functions.

While our system is certainly less sophisticated than Docbook and the PhD rendering system used by the PHP manual, it's lightweight and gets the job done for our purposes here.

File Format

Every Markdown file shares the same basic structure. Browse some of the files in this repository to see it.

We're added these simple extensions to the standard Markdown syntax:

Notices

A block surrounded with braces and a notice: marker is used at the top of pages to get the attention of the reader:

{{notice:
    This function’s solution will only work within the context 
    of the Rails framework.     
}}

Our most common use for these notices is to advise the reader of certain assumptions that we have made, e.g. that the solution is designed for Rails or a Unix-like operating system.

Code Snippets

Code snippets are surrounded with braces and a code: marker that hint about the source code within them:

{{code:php
    $array = array('chicago', 'london', 'paris');
    var_export($array);
    // => array(0 => 'chicago', 1 => 'london', 2 => 'paris')
}} 

Above, code:php indicates that the snippet should have a PHP icon and that it should use PHP syntax highlighting.

You can also use code:ruby and code:rails. Use code:rails only for snippets that make Rails-specific assumptions, e.g. those that depend on the core extensions installed by ActiveSupport.

Related Functions

The "See Also" section of each page is generated by a list of functions between braces with a related: marker:

{{related:
    array_pad
    list
    count
    range
}}

Typically, the related function list will mirror that of the PHP manual.

About

PHP functions and their equivalents in Ruby (and Rails).

Resources

Stars

Watchers

Forks