1

I have a large "config" array that I want to store in a different file (taking this practice from Laravel's config files).

After storing it in app/config/myconfig.php

<?php
return array(
  'foo' => 'bar',
);

How would I call this in my code if I wanted to assign it? E.g. $myarray = app/config/myconfig.php

2

1 Answer 1

5

Include the file:

    $myarray = include 'app/config/myconfig.php';
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, didn't know it was this trivial.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.