PHP to Ruby

Learning Ruby through PHP examples

Symbols in Ruby | an introduction to the concept of immutable strings

May 7, 2018

I want to show you the more modern way of creating hashes in Ruby, but first I need to introduce you to a concept that does not exist in PHP in any shape or form. But don’t be scared, it’s really not that complicated.

So in your application, sometimes you have these strings that represent something in the system but not necessarily for our user’s to actually read. Sometimes we end up creating “machine level” strings that have an associated canoncial name: