Skip to content

Commit 572dc61

Browse files
committed
Enable runnable (WASM) examples for datetime
php/doc-en@3a8c3e7
1 parent 7970f1c commit 572dc61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+444
-368
lines changed

reference/datetime/book.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 71692b6f4cace8dca72a18ccd80d4cd7305e5d4e Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: takagi Status: ready -->
44
<!-- CREDITS: shimooka,hirokawa,mumumu -->
55

6-
<book xml:id="book.datetime" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
6+
<book xml:id="book.datetime" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" annotations="interactive">
77
<?phpdoc extension-membership="core"?>
88
<title>日付・時刻</title>
99
<titleabbrev>Date/Time</titleabbrev>

reference/datetime/dateinterval/construct.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 71692b6f4cace8dca72a18ccd80d4cd7305e5d4e Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: takagi Status: ready -->
44
<!-- Credits: mumumu -->
55
<refentry xml:id="dateinterval.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -192,7 +192,9 @@ echo $interval->format("%d");
192192
</programlisting>
193193
&example.outputs;
194194
<screen role="php">
195+
<![CDATA[
195196
7
197+
]]>
196198
</screen>
197199
</example>
198200
</para>
@@ -203,11 +205,8 @@ echo $interval->format("%d");
203205
<programlisting role="php">
204206
<![CDATA[
205207
<?php
206-
207208
$interval = new DateInterval('P1W2D');
208209
var_dump($interval);
209-
210-
?>
211210
]]>
212211
</programlisting>
213212
&example.outputs.82;

reference/datetime/dateinterval/createfromdatestring.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 34f483426930c25870b4c5455157e7a759e0053c Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: takagi Status: ready -->
44
<!-- Credits: mumumu -->
55

66
<refentry xml:id="dateinterval.createfromdatestring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -117,7 +117,7 @@
117117
<para>
118118
<example>
119119
<title>日付の間隔のパース</title>
120-
<programlisting role="php">
120+
<programlisting role="php" annotations="non-interactive">
121121
<![CDATA[
122122
<?php
123123
// セットになっているふたつは、それぞれ同じ間隔を表します。
@@ -141,7 +141,6 @@ $i = DateInterval::createFromDateString('1 day + 12 hours');
141141
142142
$i = new DateInterval('PT3600S');
143143
$i = DateInterval::createFromDateString('3600 seconds');
144-
?>
145144
]]>
146145
</programlisting>
147146
</example>
@@ -157,13 +156,14 @@ echo $i->format('%d %h %i'), "\n";
157156
158157
$i = DateInterval::createFromDateString('1 year - 10 days');
159158
echo $i->format('%y %d'), "\n";
160-
?>
161159
]]>
162160
</programlisting>
163161
&example.outputs;
164-
<screen role="shell">
162+
<screen>
163+
<![CDATA[
165164
449 2 70
166165
1 -10
166+
]]>
167167
</screen>
168168
</example>
169169
</para>

reference/datetime/dateinterval/format.xml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 02ff7fef5b34cf8f5395180d9d39fb64d9398d00 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: takagi Status: ready -->
44
<!-- Credits: mumumu -->
55

66
<refentry xml:id="dateinterval.format" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -189,11 +189,8 @@
189189
<programlisting role="php">
190190
<![CDATA[
191191
<?php
192-
193192
$interval = new DateInterval('P2Y4DT6H8M');
194193
echo $interval->format('%d days');
195-
196-
?>
197194
]]>
198195
</programlisting>
199196
&example.outputs;
@@ -210,11 +207,8 @@ echo $interval->format('%d days');
210207
<programlisting role="php">
211208
<![CDATA[
212209
<?php
213-
214210
$interval = new DateInterval('P32D');
215211
echo $interval->format('%d days');
216-
217-
?>
218212
]]>
219213
</programlisting>
220214
&example.outputs;
@@ -234,7 +228,6 @@ echo $interval->format('%d days');
234228
<programlisting role="php">
235229
<![CDATA[
236230
<?php
237-
238231
$january = new DateTime('2010-01-01');
239232
$february = new DateTime('2010-02-01');
240233
$interval = $february->diff($january);
@@ -244,8 +237,6 @@ echo $interval->format('%a total days')."\n";
244237
245238
// 一方 %d は、月数に含まれない日数のみを出力します
246239
echo $interval->format('%m month, %d days');
247-
248-
?>
249240
]]>
250241
</programlisting>
251242
&example.outputs;

reference/datetime/dateperiod.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 576c7c43febb2eec5718d8320f92606423413983 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: takagi Status: ready -->
44
<reference xml:id="class.dateperiod" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
55

66
<title>DatePeriod クラス</title>
@@ -171,7 +171,8 @@
171171
<para>
172172
<informalexample>
173173
<programlisting role="php">
174-
<![CDATA[<?php
174+
<![CDATA[
175+
<?php
175176
$start = new DateTime('2018-12-31 00:00:00');
176177
$end = new DateTime('2021-12-31 00:00:00');
177178
$interval = new DateInterval('P1M');
@@ -188,15 +189,17 @@ $period = new DatePeriod($start, $interval, $end);
188189
echo $period->recurrences, "\n";
189190
$period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE);
190191
echo $period->recurrences, "\n";
191-
?>]]>
192+
]]>
192193
</programlisting>
193194
&example.outputs;
194195
<screen role="php">
196+
<![CDATA[
195197
5
196198
6
197199
7
198200
1
199201
0
202+
]]>
200203
</screen>
201204
</informalexample>
202205
</para>

reference/datetime/dateperiod/construct.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 7d81260767f008218ffd338b365cfa3d10eb3d15 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: takagi Status: ready -->
44
<!-- Credits: mumumu -->
55

66
<refentry xml:id="dateperiod.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -215,12 +215,12 @@ $period = new DatePeriod($iso);
215215
foreach ($period as $date) {
216216
echo $date->format('Y-m-d')."\n";
217217
}
218-
?>
219218
]]>
220219
</programlisting>
221220
&example.outputs;
222221
<screen>
223222
<![CDATA[
223+
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in script on line 11
224224
2012-07-01
225225
2012-07-08
226226
2012-07-15
@@ -249,7 +249,6 @@ $period = new DatePeriod($start, $interval, $end,
249249
foreach ($period as $date) {
250250
echo $date->format('Y-m-d')."\n";
251251
}
252-
?>
253252
]]>
254253
</programlisting>
255254
&example.outputs;
@@ -278,7 +277,6 @@ $period = new DatePeriod($begin, $interval, $end, DatePeriod::EXCLUDE_START_DATE
278277
foreach ($period as $dt) {
279278
echo $dt->format('l Y-m-d'), "\n";
280279
}
281-
?>
282280
]]>
283281
</programlisting>
284282
&example.outputs;

reference/datetime/dateperiod/createfromiso8601string.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 0070ddc45d60b6eda095053847dba544aa4339bf Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: mumumu Status: ready -->
44
<refentry xml:id="dateperiod.createfromiso8601string" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>DatePeriod::createFromISO8601String</refname>
@@ -123,15 +123,13 @@
123123
<![CDATA[
124124
<?php
125125
$iso = 'R4/2023-07-01T00:00:00Z/P7D';
126-
127126
$period = DatePeriod::createFromISO8601String($iso);
128127
129128
// DatePeriod オブジェクトを走査することで、
130129
// その期間内で発生する日付を全て出力します
131130
foreach ($period as $date) {
132131
echo $date->format('Y-m-d'), "\n";
133132
}
134-
?>
135133
]]>
136134
</programlisting>
137135
&example.outputs;

reference/datetime/dateperiod/getdateinterval.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 02ff7fef5b34cf8f5395180d9d39fb64d9398d00 Maintainer: iwamot Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: iwamot Status: ready -->
44
<!-- Reviewed: no -->
55
<refentry xml:id="dateperiod.getdateinterval" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
66
<refnamediv>
@@ -42,10 +42,9 @@
4242
<programlisting role="php">
4343
<![CDATA[
4444
<?php
45-
$period = new DatePeriod('R7/2016-05-16T00:00:00Z/P1D');
45+
$period = DatePeriod::createFromIso8601String('R7/2016-05-16T00:00:00Z/P1D');
4646
$interval = $period->getDateInterval();
4747
echo $interval->format('%d day');
48-
?>
4948
]]>
5049
</programlisting>
5150
&example.outputs;

reference/datetime/dateperiod/getenddate.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 02ff7fef5b34cf8f5395180d9d39fb64d9398d00 Maintainer: iwamot Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: iwamot Status: ready -->
44
<!-- Reviewed: no -->
55

66
<refentry xml:id="dateperiod.getenddate" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -63,7 +63,6 @@ $period = new DatePeriod(
6363
);
6464
$start = $period->getEndDate();
6565
echo $start->format(DateTime::ISO8601);
66-
?>
6766
]]>
6867
</programlisting>
6968
&examples.outputs;
@@ -84,7 +83,6 @@ $period = new DatePeriod(
8483
7
8584
);
8685
var_dump($period->getEndDate());
87-
?>
8886
]]>
8987
</programlisting>
9088
&example.outputs;

reference/datetime/dateperiod/getrecurrences.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 02ff7fef5b34cf8f5395180d9d39fb64d9398d00 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: mumumu Status: ready -->
44
<!-- Credits: mumumu -->
55

66
<refentry xml:id="dateperiod.getrecurrences" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -41,7 +41,8 @@
4141
<example>
4242
<title><methodname>DatePeriod::getRecurrences</methodname> が異なる値を返す例</title>
4343
<programlisting role="php">
44-
<![CDATA[<?php
44+
<![CDATA[
45+
<?php
4546
$start = new DateTime('2018-12-31 00:00:00');
4647
$end = new DateTime('2021-12-31 00:00:00');
4748
$interval = new DateInterval('P1M');
@@ -58,16 +59,18 @@ $period = new DatePeriod($start, $interval, $end);
5859
var_dump($period->getRecurrences());
5960
$period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE);
6061
var_dump($period->getRecurrences());
61-
?>]]>
62+
]]>
6263
</programlisting>
6364
&example.outputs;
6465
<screen role="php">
66+
<![CDATA[
6567
5
6668
5
6769
5
6870
6971
NULL
7072
NULL
73+
]]>
7174
</screen>
7275
</example>
7376
</para>

0 commit comments

Comments
 (0)