Home > Backend Development > PHP Tutorial > Implementation code for traversing stdclass object in PHP

Implementation code for traversing stdclass object in PHP

高洛峰
Release: 2023-03-03 20:10:02
Original
1133 people have browsed it

Data that needs to be operated:

$test =Array 
( 
[0] => stdClass Object 
( 
[tags] => 最快的车,Bloodhound,SSC 
[id] => 48326888 
) 
)
Copy after login

The method found on the Internet is to use get_object_vars to convert the class type into an array and then use foreach to traverse it
$array = get_object_vars($test);

More traversing stdclass object in PHP For articles related to the implementation code, please pay attention to the PHP Chinese website!


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