Created
July 4, 2012 12:03
-
-
Save sifue/3046984 to your computer and use it in GitHub Desktop.
PHPで、配列にキャストしたオブジェクトのプロパティからクラス名を取り除く ref: http://qiita.com/items/dbf0775984159bf98505
This file contains 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
$pre_array_object = (array)$original_object; | |
$array_object = array(); | |
foreach ($pre_array_object as $key => $value) { | |
$splited_key = preg_split("/[\\x0]/", $key); // 配列化すると"\u0000クラス名\u0000キー名"となるため処理 | |
$array_object[$splited_key[2]] = $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment