Created
February 8, 2013 07:09
-
-
Save acirtautas/4737217 to your computer and use it in GitHub Desktop.
Example of PHP return on include, nice feature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = include __DIR__.'/data.php'; | |
var_dump($data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$info = "Data string"; | |
return $info; |
Good point, I also find this feature very useful for configuration purposes, instead of doing file include and expecting some variable to be defined.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Often used for configuration files
Then in your system you just make a simple wrapper
Call it anywhere in your code