Mecha CMS

Helper functions.

a

Convert standard PHP object to plain array.

2.0.02.2.0

a($object, $safe = true);

Example:

test(a((object) [
    'foo' => 1,
    'bar' => 2,
    'baz' => new Foo(1)
]));

Note: If $safe is false, any class instance will be converted into array too.

Result:

[
    'foo' => 1,
    'bar' => 2,
    'baz' => Foo::__set_state([ … ])
]