Return PHP Data Arrays as a Variable

Sometimes you need to store data but you don’t want to store it in a database. For example, many configuration data is stored in simple text files. Here’s one way to store data in a structured format (using an array) in a text file and have the data easily in a local variable for use.
[cc lang=”php”]
// DATA.PHP
array (
“fieldname” => “firstname”,
“rule” => “required”,
“error_msg” => “Please fill in first name”,
),
“rule2” => array (
“fieldname” => “email”,
“rule” => “required”,
“error_msg” => “”,
)
);
?>
[/cc]
[cc lang=”php”]
// INDEX.PHP

[/cc]