Oihana PHP

keys.php

Table of Contents

Functions

keys()  : array<int, string>
Returns the list of public property names of an object.

Functions

keys()

Returns the list of public property names of an object.

keys(object $object) : array<int, string>

Only the accessible (public and dynamic) properties are returned, in declaration order, mirroring the behaviour of get_object_vars() from outside the class.

Parameters
$object : object

The source object.

Tags
example
use function oihana\core\objects\keys;

$user = (object) [ 'id' => 42 , 'name' => 'Alice' ] ;

keys( $user ) ; // [ 'id' , 'name' ]
author

Marc Alcaraz (ekameleon)

since
1.0.9
Return values
array<int, string>

A list of the object's public property names.

On this page

Search results