downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/fr/function.defined.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.misc.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'fr',
  ),
 
'this' =>
  array (
   
0 => 'function.defined.php',
   
1 => 'defined',
  ),
 
'up' =>
  array (
   
0 => 'ref.misc.php',
   
1 => 'Fonctions diverses',
  ),
 
'prev' =>
  array (
   
0 => 'function.define.php',
   
1 => 'define',
  ),
 
'next' =>
  array (
   
0 => 'function.die.php',
   
1 => 'die',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.defined" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">defined</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">defined</span> &mdash; <span class="dc-title">Vérifie l&#039;existence d&#039;une constante</span></p>

 </div>

 <a name="function.defined.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><b>defined</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$name</tt></span>
   )</div>

  <p class="para rdfs-comment">
   Vérifie l&#039;existence d&#039;une constante.
  </p>
  <blockquote><p><b class="note">Note</b>:
  
    Si vous voulez vérifier si une variable existe,
    utilisez <a href="function.isset.php" class="function">isset()</a> car <b>defined()</b>
    ne s&#039;applique qu&#039;aux <a href="language.constants.php" class="link">constants</a>.
    Si vous voulez voir si une fonction existe, utilisez
    <a href="function.function-exists.php" class="function">function_exists()</a>.
   <br />
  </p></blockquote>
 </div>


 <a name="function.defined.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">name</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       Le nom de la constante.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.defined.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne <b><tt class="constant">TRUE</tt></b> si le nom de la constante fournie par le paramètre
   <i><tt class="parameter">name</tt></i>
 a été définie, <b><tt class="constant">FALSE</tt></b> sinon.
  </p>
 </div>


 <a name="function.defined.examples"></a><div class="refsect1 examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Exemple #1 Vérifier la présence de constantes avec <b>defined()</b></b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;Notez&nbsp;que&nbsp;le&nbsp;nom&nbsp;de&nbsp;la&nbsp;constante&nbsp;est&nbsp;entre&nbsp;guillemets.&nbsp;Cet&nbsp;exemple&nbsp;vérifie<br />&nbsp;*&nbsp;si&nbsp;la&nbsp;chaîne&nbsp;'TEST'&nbsp;est&nbsp;le&nbsp;nom&nbsp;de&nbsp;la&nbsp;constante&nbsp;nommée&nbsp;TEST&nbsp;*/<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">defined</span><span style="color: #007700">(</span><span style="color: #DD0000">'TEST'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">TEST</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div><p>
  </p>
 </div>


 <a name="function.defined.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.define.php" class="function" rel="rdfs-seeAlso">define()</a> - Définit une constante</li>
    <li class="member"><a href="function.constant.php" class="function" rel="rdfs-seeAlso">constant()</a> - Retourne la valeur d'une constante</li>
    <li class="member"><a href="function.get-defined-constants.php" class="function" rel="rdfs-seeAlso">get_defined_constants()</a> - Retourne la liste des constantes et leurs valeurs</li>
    <li class="member"><a href="function.function-exists.php" class="function" rel="rdfs-seeAlso">function_exists()</a> - Indique si une fonction est définie</li>
    <li class="member">La section sur les <a href="language.constants.php" class="link">constantes</a></li>
   </ul><p>
  </p>
 </div>


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites