note 125992 added to function.require-once
| From: | boda0128318 at gmail dot com | Date: | Thu, 08 Apr 2021 16:50:00 +0000 |
| Subject: | note 125992 added to function.require-once | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216263@lists.php.net to get a copy of this message | ||
1 - "require" and "require_once" throw a fatal error if the file is not
existing and stop the script execution
2 - "include" and "include_once" throw a warning and the execution
continues
3 - "require_once" and "include_once" as their names suggests ,
they will not include the file if the file was already included with
"require", "require_once", "include" or "include_once"
try the following code:
create a file called "index.php"
<?php
require "first.php"; // this will include the file
include_once "first.php"; // this will not as it was included using "require"
require_once "first.php"; // this will not as it was included using "require"
?>
and another file that is called "first.php" and write the following header
-------------------------------
<h1>Hello every one</h1>
--------------------------------
i hope this will help you
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 154.176.88.107)
----
Manual Page -- https://php.net/manual/en/function.require-once.php
Edit -- https://main.php.net/note/edit/125992
Del: integrated -- https://main.php.net/note/delete/125992/integrated
Del: useless -- https://main.php.net/note/delete/125992/useless
Del: bad code -- https://main.php.net/note/delete/125992/bad+code
Del: spam -- https://main.php.net/note/delete/125992/spam
Del: non-english -- https://main.php.net/note/delete/125992/non-english
Del: in docs -- https://main.php.net/note/delete/125992/in+docs
Del: other reasons-- https://main.php.net/note/delete/125992
Reject -- https://main.php.net/note/reject/125992
Search -- https://main.php.net/manage/user-notes.php