jord-jd/object_to_array
最新稳定版本:v3.0.0
Composer 安装命令:
composer require jord-jd/object_to_array
包简介
This PHP package provides an `object_to_array` helper function.
README 文档
README
This PHP package provides an object_to_array helper function. You can use this function to convert an object to an array.
Installation
The object_to_array package can be easily installed using Composer. Just run the following command from the root of your project.
composer require "jord-jd/object_to_array"
If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started.
Usage
Here are a few examples of how to use the object_to_array helper function.
// Basic object $object = new stdClass; $object->name = 'John'; $object->age = 32; $array = object_to_array($object) /* $array = [ 'name' => 'John', 'age' => 32 ]; */
// Object with nested object $object = new stdClass; $object->name = 'John'; $object->age = 32; $object->pet = new stdClass; $object->pet->type = 'cat'; $object->pet->name = 'Mr Fluffkins The Third'; $array = object_to_array($object) /* $array = [ 'name' => 'John', 'age' => 32, 'pet' => [ 'name' => 'Mr Fluffkins The Third', 'type' => 'cat' ] ]; */
// Object with nested array $object = new stdClass; $object->name = 'John'; $object->age = 32; $object->favouriteFoods = [ 'pizza', 'cake' ]; $array = object_to_array($object) /* $array = [ 'name' => 'John', 'age' => 32, 'favouriteFoods' => [ 'pizza', 'cake' ] ]; */
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-only
- 更新时间: 2026-02-14