note 120199 deleted from function.require-once by cmb
| From: | cmb@php.net | Date: | Wed, 23 Nov 2016 18:58:08 +0000 |
| Subject: | note 120199 deleted from function.require-once by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207541@lists.php.net to get a copy of this message | ||
Note Submitter: Walter P (checkmater at gmail)
----
If you are including a file that returns something and your script tries to re-include it, you will
not recevie the expected return from your file but a (boolean) true.
eg.
index.php
<?php
$a = require_once('other.php');
var_dump($a);
$a = require_once('other.php');
var_dump($a);
?>
other.php
<?php
return [1,2,3];
?>
Will output:
index.php:3:
array (size=3)
0 => int 1
1 => int 2
2 => int 3
index.php:5:
boolean true