Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP对象与数组互相转换 | 织织 #12

Open
mist-river opened this issue Aug 26, 2020 · 0 comments
Open

PHP对象与数组互相转换 | 织织 #12

mist-river opened this issue Aug 26, 2020 · 0 comments

Comments

@mist-river
Copy link
Owner

https://zhizhi123.com/2016/12/03/php-objects-convert-to-and-from-arrays/

工作中不可避免会遇到php对象与数组的相互转化,下边对其方法做了简单的总结。 1.强制转化arr = (array) ​obj; obj = (object) ​arr; 优点:比较简洁 缺点:不能递归转化 适用范围:无嵌套数组,无嵌套类的转化 2.自定义方法object2array ,array2object 12345678910111213141516171819202122232

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant