I'm sure this is an easy question, but I'm new to PHP and can't figure it out. I'm trying to parse a .ini file, which works correctly, but I somehow can't access the values.
My site is structured like this:
project/
index.php
inc/
init.php
classes/
frontend.php
msg/
messages.ini
The messages file is parsed in init.php
with $messages = parse_ini_file("msg/messages.ini");
and then included in index.php
like this:
<?php
require_once('inc/init.php');
//printing the array here works!
$html = new frontend();
If I print the messages array from index.php
everything works fine.
Yet when the index.php
builds the new frontend();
the $messages
array is not available there. The frontend
itself is loaded in init.php
and works fine without the ini file.
Thus I assume there is an import or variable scope issue, but I can't figure it out. Can someone point me in the right direction?