Skip to content

Instantly share code, notes, and snippets.

View jmlagace's full-sized avatar

Jean-Marc Lagacé jmlagace

View GitHub Profile
@jmlagace
jmlagace / to_ruby_hash.php
Last active December 29, 2020 21:23 — forked from yoshitsugu/to_ruby_hash.php
PHPのArrayをRubyのHashに変換。PHP Array to Ruby Hash
function to_ruby_hash($array){
$result = "{";
foreach($array as $key => $value){
$result .= "\"".$key."\" => ";
if(is_array($value) || is_object($value)){
$result .= to_ruby_hash($value).",\n";
}else{
$result .= "\"".$value."\",";
}
}