note 119659 deleted from function.return by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:28:28 +0000 |
| Subject: | note 119659 deleted from function.return by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210788@lists.php.net to get a copy of this message | ||
Note Submitter: sebi at sebi dot moe
----
One situation where returning a value from a script and using it could be considered a good use is
config files. Zend Framework 2 promotes this structure for this purpose, and it works pretty well.
Example config file:
<?php
return [
'site' => 123,
'settings' => 'asd'
];
Reading:
<?php
$config = (require 'config.php');
// Or
$config = array_merge(require 'config/local.php', require
'config/application.php');