note 120199 added to function.require-once
| From: | (checkmateratgmail) | Date: | Mon, 21 Nov 2016 21:52:24 +0000 |
| Subject: | note 120199 added to function.require-once | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-207320@lists.php.net to get a copy of this message | ||
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
----
Server IP: 72.52.91.14
Probable Submitter: 190.130.102.49
----
Manual Page -- http://php.net/manual/en/function.require-once.php
Edit -- https://master.php.net/note/edit/120199
Del: integrated -- https://master.php.net/note/delete/120199/integrated
Del: useless -- https://master.php.net/note/delete/120199/useless
Del: bad code -- https://master.php.net/note/delete/120199/bad+code
Del: spam -- https://master.php.net/note/delete/120199/spam
Del: non-english -- https://master.php.net/note/delete/120199/non-english
Del: in docs -- https://master.php.net/note/delete/120199/in+docs
Del: other reasons-- https://master.php.net/note/delete/120199
Reject -- https://master.php.net/note/reject/120199
Search -- https://master.php.net/manage/user-notes.php