mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-30 04:42:24 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@166928 c90b9560-bf6c-de11-be94-00142212c4b1
79 lines
2.2 KiB
XML
79 lines
2.2 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.11 $ -->
|
|
<!-- EN-Revision: 1.8 Maintainer: dams Status: partial -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry id="function.defined">
|
|
<refnamediv>
|
|
<refname>defined</refname>
|
|
<refpurpose>Vérifie l'existence d'une constante</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>defined</methodname>
|
|
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>defined</function> retourne &true; si la constante nommée
|
|
<parameter>name</parameter> a été définie,
|
|
et &false; sinon.
|
|
Pour tester l'existence d'une fonction utilisez
|
|
<function>function_exists</function>.
|
|
<example>
|
|
<title>
|
|
Vérifier la présence de constantes avec <function>defined</function>
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if (defined("CONSTANT")){
|
|
// Notez que le nom de la constante est entre guillemets
|
|
echo CONSTANT;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Si vous voulez vérifier si une variable existe,
|
|
utilisez <function>isset</function> car <function>defined</function>
|
|
ne s'applique qu'aux <link linkend="language.constants">constants</link>.
|
|
Si vous voulez voir si une fonction existe, utilisez
|
|
<function>function_exists</function>.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
Voir aussi
|
|
<function>define</function>,
|
|
<function>constant</function>,
|
|
<function>get_defined_constants</function>,
|
|
la section sur les
|
|
<link linkend="language.constants">constantes</link> et
|
|
<function>function_exists</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|