Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

array_keys on Phalcon\Config(array)

Don't know if i choose the correct catgory, but it is what it is :)

Moving more and more of my applications to phalcon and consolidating my ini files keeps me hitting the wall over and over again :)

This time i'm having a strange (or mabye not so strange) issue.

Im trying to use array_keys on one of my two dimensional arrays. This works just fine when i create the array as normal array, but it would be nice to have it in a phalcon config class.

The config file (called regex.php) is just an array of regexes:

I have this file pared into my $di and var_dumping $di['regex']->haps shows the array fine. But using array_keys on it seems to be impossible, most likley due wrong type (not array)

Regards André



4.6k
Accepted
answer
edited Jan '16

Writing this post myself gave me the answer, wrong type. By getting the object properties (get_object_vars()) on the regex array it all magically seems to be working

You can also call toArray() on a config object.