Created
April 13, 2011 06:38
-
-
Save rummelonp/917075 to your computer and use it in GitHub Desktop.
stdClassを連想配列に変換する程度の関数
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function stdClassToArray($obj) | |
{ | |
if (!is_object($obj) && !is_array($obj)) { | |
return $obj; | |
} | |
$arr = (array)$obj; | |
foreach ($arr as $key => $value) { | |
unset($arr[$key]); | |
$key = str_replace('@', '', $key); | |
$arr[$key] = stdClassToArray($value); | |
} | |
return $arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment