mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-24 08:52:09 +01:00
133 lines
3.4 KiB
XML
133 lines
3.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 4d3d1ebea1eeecb7f76fb2fa8ecb55ef35d1d518 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.ord">
|
|
<refnamediv>
|
|
<refname>ord</refname>
|
|
<refpurpose>Convertit le premier octet d'une chaîne en une valeur entre 0 et 255</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>ord</methodname>
|
|
<methodparam><type>string</type><parameter>character</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Interprète la valeur binaire du premier octet de <parameter>character</parameter>
|
|
en tant qu'un &integer; non signé entre 0 et 255.
|
|
</para>
|
|
<para>
|
|
Si la &string; est dans un encodage sur un octet tel que ASCII, ISO-8859, ou
|
|
Windows 1252, ceci est équivalent à retourner la position d'un caractère dans la
|
|
table de correspondance de l'encodage. Cependant, il est à noter que cette fonction
|
|
n'est pas conscient d'aucun encodage de &string;, et en particulier n'identifiera
|
|
jamais une valeur de point de code Unicode dans un encodage multioctet tel que
|
|
UTF-8 ou UTF-16.
|
|
</para>
|
|
<para>
|
|
Cette fonction complète <function>chr</function>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>character</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un caractère.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Un &integer; entre 0 et 255.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>ord</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$str = "\n";
|
|
if (ord($str) == 10) {
|
|
echo "Le premier caractère de \$str est une nouvelle ligne\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Examiner les octets individuels d'une chaîne UTF-8</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
declare(encoding='UTF-8');
|
|
$str = "🐘";
|
|
for ( $pos=0; $pos < strlen($str); $pos ++ ) {
|
|
$byte = substr($str, $pos);
|
|
echo 'Octet ' . $pos . ' de $str a comme valeur ' . ord($byte) . PHP_EOL;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
Octet 0 de $str a comme valeur 240
|
|
Octet 1 de $str a comme valeur 159
|
|
Octet 2 de $str a comme valeur 144
|
|
Octet 3 de $str a comme valeur 152
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>chr</function></member>
|
|
<member><link xlink:href="&url.asciitable;">Table ASCII</link></member>
|
|
<member><function>mb_ord</function></member>
|
|
<member><function>IntlChar::ord</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
|
|
-->
|