get_namespace()

Since v1.4.0

Description

get_namespace() returns a class or object's namespace.

public static string get_namespace(string|object $item);

Parameters

The input parameters are:

Return Value

get_namespace() returns a string. It contains the namespace that the class or object is defined in.

Throws

get_namespace() throws these exceptions:

Works With

get_namespace() is supported on these versions of PHP:

PHP Version Works?
5.5 Yes
5.6 Yes
7.0 Yes
HHVM Yes