Mecha CMS

Helper functions.

o

Convert array to plain object.

2.0.0

o($array, $safe = true);

Example:

test(o([
    'foo' => 1,
    'bar' => 2,
    'baz' => new Foo(1),
    'qux' => [1, 2, 3, 4, 5]
]));

Note: If $safe is false, sequence array will be converted into object too.

Result:

(object) [
    'foo' => 1,
    'bar' => 2,
    'baz' => Foo::__set_state([ … ]),
    'qux' => [1, 2, 3, 4, 5]
]