Config.ini problem implementing multidimensional arrays

454 views
Skip to first unread message

Clement Pietri

unread,
Sep 8, 2015, 9:36:12 PM9/8/15
to Fat-Free Framework
Hello to the community, 

I am playing with multidimensional arrays on a config.ini file: I am trying to use the customs sections of an ini to create my array, but failed to do so.

I have a following ini files.

[globals]
[foo]
a=1
b=2
[foo.hash]
x=1
y=2
z=3

and when I do a var_dump in the variable it returns null. However, if I do the following it works.
[globals]
foo[a]=1
foo[b]=2
foo[hash]=1,2,3
but then I do not have the keys of the hash section

I was following this: this (doc custom sections)

and so I want to replicate this in the ini:
$f3->set('foo',array(
'a' => 1,
'b' => 2,
'hash' => array(
'x' => 1,
'y' => 2,
'z' => 3
)
));


Could you let me know what am I doing wrong ?

Thanks in advance.

Vincent de Vreede

unread,
Sep 9, 2015, 8:26:00 AM9/9/15
to f3-fra...@googlegroups.com
Are you using $f3->get('foo') to make your var_dump?

Edit: nvm, it also works with $f3->foo. For me the example works perfect ,are you using the latest version of F3?

Op woensdag 9 september 2015 03:36:12 UTC+2 schreef Clement Pietri:

Clement Pietri

unread,
Sep 10, 2015, 5:28:10 AM9/10/15
to Fat-Free Framework
Yes I do use the get method:
var_dump($f3->get('foo'));

If I declare a one-dimensional array in the .ini it works, but two-dimensions array does not.

I called the ini file like the following:
$f3->config('app/configuration.ini');

Thanks

P.S. I use the last version of fat-free.

Clement Pietri

unread,
Sep 10, 2015, 5:34:18 AM9/10/15
to Fat-Free Framework
Okay I think I might have touch a file in the lib folder coz I re-download the lib folder and now everything is working, my bad!!!

Sorry to have polluted the forum with this post, I should have checked the version before.

Anyway Thank you to Vincent for your answer.

Have all a great day
Reply all
Reply to author
Forward
0 new messages