We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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é



8.7k
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.