11<?xml version =" 1.0" encoding =" utf-8" ?>
22<!-- $Revision$ -->
3- <!-- EN-Revision: 5499acf9df7e1338d540bde207acc859792cd139 Maintainer: takagi Status: ready -->
3+ <!-- EN-Revision: b8147b7f03506e41f01631c32a907b955593525a Maintainer: takagi Status: ready -->
44<!-- Credits: mumumu -->
55
66<sect1 xml : id =" control-structures.declare" xmlns =" http://docbook.org/ns/docbook" xmlns : xlink =" http://www.w3.org/1999/xlink" >
@@ -36,7 +36,7 @@ declare (ディレクティブ)
3636 ディレクティブの値として渡せるのは、リテラルだけとなります。
3737 変数や定数は、使えません。以下に例を示します。
3838 <informalexample >
39- <programlisting role =" php" >
39+ <programlisting role =" php" annotations = " non-interactive " >
4040<![CDATA[
4141<?php
4242// これは有効です
@@ -45,7 +45,6 @@ declare(ticks=1);
4545// これは無効です
4646const TICK_VALUE = 1;
4747declare(ticks=TICK_VALUE);
48- ?>
4948]]>
5049 </programlisting >
5150 </informalexample >
@@ -61,7 +60,7 @@ declare(ticks=TICK_VALUE);
6160 (しかし、<literal >declare</literal > を含むファイルがインクルードされた場合は、
6261 親ファイルにはその影響は及びません)。
6362 <informalexample >
64- <programlisting role =" php" >
63+ <programlisting role =" php" annotations = " non-interactive " >
6564<![CDATA[
6665<?php
6766// 以下は同じ意味です
@@ -74,7 +73,6 @@ declare(ticks=1) {
7473// こうすることもできます
7574declare(ticks=1);
7675// ここにすべてのスクリプトを書きます
77- ?>
7876]]>
7977 </programlisting >
8078 </informalexample >
@@ -119,12 +117,20 @@ $a = 1; // tick イベント発生
119117
120118if ($a > 0) {
121119 $a += 2; // tick イベント発生
122- print $a; // tick イベント発生
120+ print $a . "\n" ; // tick イベント発生
123121}
124-
125- ?>
126122]]>
127123 </programlisting >
124+ &example.outputs;
125+ <screen >
126+ <![CDATA[
127+ tick_handler() called
128+ tick_handler() called
129+ tick_handler() called
130+ 3
131+ tick_handler() called
132+ ]]>
133+ </screen >
128134 </example >
129135 </para >
130136 <simpara >
@@ -139,12 +145,11 @@ if ($a > 0) {
139145 <literal >encoding</literal > ディレクティブを使用します。
140146 <example >
141147 <title >スクリプトのエンコーディングの宣言</title >
142- <programlisting role =" php" >
148+ <programlisting role =" php" annotations = " non-interactive " >
143149<![CDATA[
144150<?php
145151declare(encoding='ISO-8859-1');
146152// ここにコードを書きます
147- ?>
148153]]>
149154 </programlisting >
150155 </example >
0 commit comments