当前位置:网站首页>学习使用php把stdClass Object转array的方法整理
学习使用php把stdClass Object转array的方法整理
2022-08-04 09:19:00 【徊忆羽菲】
学习使用php把stdClass Object转array的方法整理
对象转数组方法
function object2array_pre(&$object) {
if (is_object($object)) {
$arr = (array)($object);
} else {
$arr = &$object;
}
if (is_array($arr)) {
foreach($arr as $varName => $varValue){
$arr[$varName] = $this->object2array($varValue);
}
}
return $arr;
}
function object2array(&$object) {
$object = json_decode( json_encode( $object),true);
return $object;
}
以上两个方法结合使用
边栏推荐
- 外包干了四年,秋招终于上岸了
- Inheritance and the static keyword
- 【C补充】指向指针或函数的指针
- Explanation of spark operator
- Interview at 14:00 in the afternoon, I came out at 14:08 with my head down, asking too much...
- 反序列化漏洞
- 并发编程之生产者和消费者问题
- 优炫数据库只有数据文件如何恢复
- 2022-08-02 分析RK817 输出32k clock PMIC_32KOUT_WIFI给WiFi模块 clock 注册devm_clk_hw_register
- Detailed explanation of NAT/NAPT address translation (internal and external network communication) technology [Huawei eNSP]
猜你喜欢

sync-diff-inspector 使用实践

蘑菇书EasyRL学习笔记

Post-94 Byte P7 posted the salary slip: It's really good to make up for this...

spark算子讲解
![[Punctuality Atomic STM32 Serial] Chapter 1 Learning Method of the Book Excerpted from [Punctuality Atomic] MiniPro STM32H750 Development Guide_V1.1](/img/99/23e3dcb426769a415e33f7ff51bbb8.png)
[Punctuality Atomic STM32 Serial] Chapter 1 Learning Method of the Book Excerpted from [Punctuality Atomic] MiniPro STM32H750 Development Guide_V1.1

《福格行为模型》:如何养成好习惯?

VRRP+MSTP配置详解【华为eNSP实验】

Anton Paar Anton Paar Density Meter Hydrometer Repair DMA35 Performance Parameters
![Detailed explanation of MSTP protocol configuration on Layer 3 switches [Huawei eNSP experiment]](/img/97/6c3662ef36b02bc42eec95abaa6bc5.png)
Detailed explanation of MSTP protocol configuration on Layer 3 switches [Huawei eNSP experiment]
![Detailed explanation of telnet remote login aaa mode [Huawei eNSP]](/img/cf/aaf3a0b794b1076423fc5b90ecc9f0.png)
Detailed explanation of telnet remote login aaa mode [Huawei eNSP]
随机推荐
MindSpore:MindSpore GPU版本安装问题
【云驻共创】HCSD 大咖直播–就业指南
[Punctuality Atom STM32 Serial] Chapter 2 STM32 Introduction Excerpted from [Punctual Atom] MiniPro STM32H750 Development Guide_V1.1
记录十条工作中便利的API小技巧
MindSpore:【mindinsight】【Profiler】用execution_time推导出来的训练耗时远小于真实的耗时
【正点原子STM32连载】第二章 STM32简介 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1
Detailed explanation of switch link aggregation [Huawei eNSP]
渗透——信息收集
ZbxTable 2.0 重磅发布!6大主要优化功能!
SQL后计算的利器
[Punctuality Atom STM32 Serial] Chapter 4 STM32 First Experience Excerpted from [Punctual Atom] MiniPro STM32H750 Development Guide_V1.1
Unity3D 数据加密
Four common methods of network attacks and their protection
如何快速将Zabbix5.0升级至6.0?
It is found that several WRH tables are locked, what should I do?
并发编程之生产者和消费者问题
注意力机制
Grafana9.0发布,Prometheus和Loki查询生成器、全新导航、热图面板等新功能!
Interview at 14:00 in the afternoon, I came out at 14:08 with my head down, asking too much...
sync-diff-inspector 使用实践