mirror of
https://github.com/php/doc-pl.git
synced 2026-03-24 07:02:07 +01:00
Well, it doesn't really make the Polish manual much better but it does reduce the amount of outdated files substantially leaving the ones that deserve some actual work and thought.
69 lines
1.6 KiB
XML
69 lines
1.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: 23fef04c872071ca5665fd75e8f4270ca960fb78 Maintainer: dombal Status: ready -->
|
|
<!-- $Revision$ -->
|
|
<!-- CREDITS: joeaccord -->
|
|
|
|
<appendix xml:id="tokenizer.examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
Poniżej zamieszczony jest prosty przykład skryptu PHP,
|
|
który używa tokenizera. Skrypt wczytuje plik PHP, usuwa wszystkie
|
|
komentarze z kodu źródłowego i wyświetla sam czysty kod.
|
|
</para>
|
|
<example>
|
|
<title>Usuwanie komentarzy za pomocą tokenizera</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$kod = file_get_contents("jakisplik.php");
|
|
$tokeny = token_get_all($kod);
|
|
|
|
foreach ($tokeny as $token) {
|
|
if (is_string($token)) {
|
|
// prosty token jednoznakowy
|
|
echo $token;
|
|
} else {
|
|
// tablica definiująca token
|
|
list($id, $tekst) = $token;
|
|
|
|
switch ($id) {
|
|
case T_COMMENT:
|
|
case T_DOC_COMMENT:
|
|
// brak akcji dla komentarzy
|
|
break;
|
|
default:
|
|
// wszystko inne -> wyświetl "takie, jakie jest"
|
|
echo $tekst;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</appendix>
|
|
|
|
|
|
<!-- 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
|
|
-->
|
|
|