<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >require_once</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="Control Structures" HREF="language.control-structures.html"><LINK REL="PREVIOUS" TITLE="include" HREF="function.include.html"><LINK REL="NEXT" TITLE="include_once" HREF="function.include-once.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.include.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Cap. 11. Control Structures</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.include-once.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="function.require-once" ><A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A ></A ></H1 ><P > The <A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A > statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the <A HREF="function.require.html" ><B CLASS="function" >require()</B ></A > statement, with the only difference being that if the code from a file has already been included, it will not be included again. See the documentation for <A HREF="function.require.html" ><B CLASS="function" >require()</B ></A > for more information on how this statement works. </P ><P > <A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A > should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc. </P ><P > For examples on using <A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A > and <A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A >, look at the <A HREF="http://pear.php.net/" TARGET="_top" >PEAR</A > code included in the latest PHP source code distributions. </P ><P > <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > <A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A > was added in PHP 4.0.1pl2 </P ></BLOCKQUOTE ></DIV > </P ><P > <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > Be aware, that the behaviour of <A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A > and <A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A > may not be what you expect on a non case sensitive operating system (such as Windows). <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN2909" ></A ><P ><B >Exemplu 11-8. <A HREF="function.require-once.html" ><B CLASS="function" >require_once()</B ></A > is case insensitive on Windows</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#007700">require_once(</font><font color="#DD0000">"a.php"</font><font color="#007700">); </font><font color="#FF8000">// this will include a.php<br /></font><font color="#007700">require_once(</font><font color="#DD0000">"A.php"</font><font color="#007700">); </font><font color="#FF8000">// this will include a.php again on Windows!<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></BLOCKQUOTE ></DIV > </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Avertisment</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >Windows versions of <VAR CLASS="literal" >PHP</VAR > prior to PHP 4.3 do not support accessing remote files via this function, even if <A HREF="ref.filesystem.html#ini.allow-url-fopen" >allow_url_fopen</A > is enabled. </P ></TD ></TR ></TABLE ></DIV ><P > See also <A HREF="function.require.html" ><B CLASS="function" >require()</B ></A >, <A HREF="function.include.html" ><B CLASS="function" >include()</B ></A >, <A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A >, <A HREF="function.get-required-files.html" ><B CLASS="function" >get_required_files()</B ></A >, <A HREF="function.get-included-files.html" ><B CLASS="function" >get_included_files()</B ></A >, <A HREF="function.readfile.html" ><B CLASS="function" >readfile()</B ></A >, and <A HREF="function.virtual.html" ><B CLASS="function" >virtual()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.include.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.include-once.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.include.html" ><B CLASS="function" >include()</B ></A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="language.control-structures.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.include-once.html" ><B CLASS="function" >include_once()</B ></A ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >