I've stored some website configuration data in a config.json file, with things like database connection parameters and routes. Something like this:

{
    "production" : { ... },
    "test" : { ... },
    "development" : { ... }
}

And the content is loaded with:

$config = json_decode(file_get_contents('config'), true);

However, inspecting some frameworks, I see direct usage of PHP scripts for configuration storage:

<?php
return array(
    'production' => array( ... ),
    'test' => array( ... ),
    'development' => array( ... )
);
<?php $config = (require 'config.php');

Which approach is the best?

Edit
Report