Home > Backend Development > PHP Tutorial > Usage example of get_object_vars() method in php, phpget_object_vars_PHP tutorial

Usage example of get_object_vars() method in php, phpget_object_vars_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:07:28
Original
1014 people have browsed it

Usage example of get_object_vars() method in php, phpget_object_vars

This article analyzes the usage of get_object_vars() method in PHP with examples. Share it with everyone for your reference. The specific analysis is as follows:

Syntax: get_object_var($object), returns an array. Get the attributes in the $object object and form an array

Example:

<&#63;php
class person{
 public $name="王美人";
 public $age = 25;
 public $birth;
}
$p = new person();
print_r(get_object_vars($p));
&#63;>
Copy after login

Output result:

Array ( [name] => 王美人 [age] => 25 [birth] => )

Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/955406.htmlTechArticleUsage examples of get_object_vars() method in php, phpget_object_vars This example analyzes the usage of get_object_vars() method in php. Share it with everyone for your reference. The specific analysis is as follows: Language...
Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template