Home > Backend Development > PHP Tutorial > php stdClass种

php stdClass种

WBOY
Release: 2016-06-13 10:56:17
Original
835 people have browsed it

php stdClass类

1.数组转对象。

$arr_a=array();
$arr_a['a']=1;
$arr_a['b']=2;

可以写成
$arr_a=array();
$arr_a=(object)$arr_a;
$arr_a->a=1;
$arr_a->b=2;

2.stdClass的使用

$obj_a=new stdClass();
$obj_a->a=1;
$obj_a->b=2;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template