stdClass -> Array 로 바꾸는 법.
<?php
function objectToArray($d) {
if (is_object($d)) {
// Gets the properties of the given object
// with get_object_vars function
$d = get_object_vars($d);
}
if (is_array($d)) {
/*
* Return array converted to object
* Using __FUNCTION__ (Magic constant)
* for recursive call
*/
return array_map(__FUNCTION__, $d);
}
else {
// Return array
return $d;
}
}
?>
Array -> stdClass
<?php
function arrayToObject($d) {
if (is_array($d)) {
/*
* Return array converted to object
* Using __FUNCTION__ (Magic constant)
* for recursive call
*/
return (object) array_map(__FUNCTION__, $d);
}
else {
// Return object
return $d;
}
}
?>
<?php
function objectToArray($d) {
if (is_object($d)) {
// Gets the properties of the given object
// with get_object_vars function
$d = get_object_vars($d);
}
if (is_array($d)) {
/*
* Return array converted to object
* Using __FUNCTION__ (Magic constant)
* for recursive call
*/
return array_map(__FUNCTION__, $d);
}
else {
// Return array
return $d;
}
}
?>
Array -> stdClass
<?php
function arrayToObject($d) {
if (is_array($d)) {
/*
* Return array converted to object
* Using __FUNCTION__ (Magic constant)
* for recursive call
*/
return (object) array_map(__FUNCTION__, $d);
}
else {
// Return object
return $d;
}
}
?>
게시글 목록
| 번호 | 제목 |
|---|---|
| 33411 | |
| 33410 | |
| 33409 | |
| 33408 | |
| 33407 | |
| 33404 | |
| 33403 | |
| 33402 | |
| 33399 | |
| 33398 | |
| 33390 | |
| 33386 | |
| 33377 | |
| 33356 | |
| 33348 | |
| 33340 | |
| 33334 | |
| 33333 | |
| 33329 | |
| 33322 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기