Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Forked from wtnabe/to_php.rb
Created July 8, 2011 15:24
Show Gist options
  • Save rummelonp/1072074 to your computer and use it in GitHub Desktop.
Save rummelonp/1072074 to your computer and use it in GitHub Desktop.
Translate from your Ruby object to PHP literal
class Object
def to_php
self.inspect.gsub( /[\[{]/, 'array(' ).gsub( /[}\]]/, ')' )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment