mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-26 01:42:09 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@351954 c90b9560-bf6c-de11-be94-00142212c4b1
77 lines
2.0 KiB
XML
77 lines
2.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 7104ee97ced1768a3231588dfc0bc0d7eb1117ad Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<sect1 xml:id="control-structures.break" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<title>break</title>
|
|
<?phpdoc print-version-for="break"?>
|
|
<simpara>
|
|
L'instruction <literal>break</literal> permet de sortir d'une structure
|
|
<literal>for</literal>, <literal>foreach</literal>,
|
|
<literal>while</literal>, <literal>do-while</literal>
|
|
ou <literal>switch</literal>.
|
|
</simpara>
|
|
<simpara>
|
|
<literal>break</literal> accepte un argument numérique optionnel
|
|
qui vous indiquera combien de structures emboîtées doivent être
|
|
interrompues. La valeur par défaut est <literal>1</literal>, seulement la
|
|
structure emboitée immédiate est interrompue.
|
|
</simpara>
|
|
<para>
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$arr = array('un', 'deux', 'trois', 'quatre', 'stop', 'cinq');
|
|
foreach ($arr as $val) {
|
|
if ($val == 'stop') {
|
|
break; /* Vous pourriez aussi utiliser 'break 1;' ici. */
|
|
}
|
|
echo "$val<br />\n";
|
|
}
|
|
|
|
/* Utilisation de l'argument optionnel. */
|
|
|
|
$i = 0;
|
|
while (++$i) {
|
|
switch ($i) {
|
|
case 5:
|
|
echo "At 5<br />\n";
|
|
break 1; /* Termine uniquement le switch. */
|
|
case 10:
|
|
echo "At 10; quitting<br />\n";
|
|
break 2; /* Termine le switch et la boucle while. */
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
|
|
</sect1>
|
|
|
|
<!-- 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
|
|
-->
|