mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-24 08:52:09 +01:00
180 lines
4.9 KiB
XML
180 lines
4.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 4fd318ca791ef360c5b19a17c8045f7446aa9740 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.phpversion" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>phpversion</refname>
|
|
<refpurpose>Retourne le numéro de la version courante de PHP</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>string</type><type>false</type></type><methodname>phpversion</methodname>
|
|
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>extension</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Retourne le numéro de la version courante de PHP.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>extension</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un nom d'extension, optionnel.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne la version actuelle de PHP en tant que <type>string</type>.
|
|
Si un argument <type>string</type> est fournit au paramètre
|
|
<parameter>extension</parameter>, <function>phpversion</function>
|
|
retourne la version de cette extension, ou &false; s'il n'y a pas
|
|
d'information de version associé ou cette extension n'est pas activé.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
<parameter>extension</parameter> est désormais nullable.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>phpversion</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// affiche le numéro de version courante du PHP.
|
|
echo 'Version PHP courante : ' . phpversion();
|
|
|
|
// affiche e.g. '2.0' ou rien du tout si cette extension n'est pas active
|
|
echo phpversion('tidy');
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <constant>PHP_VERSION_ID</constant></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// PHP_VERSION_ID est disponible depuis PHP 5.2.7,
|
|
// si votre version est antérieure, émulez-le.
|
|
if (!defined('PHP_VERSION_ID')) {
|
|
$version = explode('.',PHP_VERSION);
|
|
|
|
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
|
|
}
|
|
|
|
// PHP_VERSION_ID est défini comme un nombre : plus il est grand, plus
|
|
// la version de PHP est récente. Il est défini comme illustré dans
|
|
// le code ci-dessous :
|
|
//
|
|
// $version_id = $major_version * 10000 + $minor_version * 100 + $release_version;
|
|
//
|
|
// Maintenant, avec PHP_VERSION_ID, il est possible de vérifier la disponibilité
|
|
// de fonctionnalités de PHP, sans passer par version_compare().
|
|
//
|
|
// Par exemple, on peut définir les constantes PHP_VERSION_* qui n'étaient pas
|
|
// disponibles avant 5.2.7
|
|
|
|
if (PHP_VERSION_ID < 50207) {
|
|
define('PHP_MAJOR_VERSION', $version[0]);
|
|
define('PHP_MINOR_VERSION', $version[1]);
|
|
define('PHP_RELEASE_VERSION', $version[2]);
|
|
|
|
// etc.
|
|
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
Cette information est aussi disponible via la constante
|
|
prédéfinie <constant>PHP_VERSION</constant>. Plus d'informations
|
|
sur les versions, avec les constantes <constant>PHP_VERSION_*</constant>.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
Certaines extensions peuvent définir leur propre numéro de version.
|
|
Cependant, la plupart des extensions incluses utiliseront la version de PHP comme numéro de version.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><link linkend="reserved.constants.core">les constantes PHP_VERSION</link></member>
|
|
<member><function>version_compare</function></member>
|
|
<member><function>phpinfo</function></member>
|
|
<member><function>phpcredits</function></member>
|
|
<member><function>zend_version</function></member>
|
|
</simplelist>
|
|
</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:"~/.phpdoc/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
|
|
-->
|