includeme.php:
$x = 5;
return $x;
main.php:
$myX = require 'includeme.php';
also gives the same result
This is one of those little-known features of PHP, but it can be kind of nice for setting up really simple config files.
More Related Contents:
- Asynchronous shell exec in PHP
- PHP How to determine the first and last iteration in a foreach loop?
- method=”post” enctype=”text/plain” are not compatible?
- How to locate the php.ini file (xampp)
- INSERT – Number of bind variables doesn’t match number of fields in prepared statement
- PHP Install SSH2 on Windows machine
- file_put_contents – failed to open stream: Permission denied
- $_SERVER[“REMOTE_ADDR”] gives server IP rather than visitor IP
- How do I remove blank lines from text in PHP?
- How to get CPU usage and RAM usage without exec?
- Make mp3 seekable PHP
- Codeigniter – Using Multiple Databases
- Partially hide email address in PHP
- How to delete files from directory based on creation date in php?
- $_FILES field ‘tmp_name’ has no value on .JPG file extension
- int variable with leading zero?
- How to add extra whitespace in PHP?
- Count the number of pages in a PDF in only PHP [closed]
- How to obtain a nested HTML list from object’s array recordset?
- PHP – parse current URL
- Connecting to remote MySQL server using PHP
- Laravel pluck fields from relations
- How do I declare a two dimensional array?
- PHP Streaming MP3
- Remotely connecting to a MySQL database
- How to login using Github, Facebook, Gmail and Twitter in Laravel 5.1?
- Fatal error: Call to a member function prepare() on a non-object in
- Static class initializer in PHP
- What is difference of developing a website in MVC and 3-Tier or N-tier architecture?
- Single Session Login in Laravel