Skip to content

Enable runnable (WASM) examples for language.control-structures section#5462

Open
AllenJB wants to merge 4 commits into
php:masterfrom
AllenJB:runnable_lang_ctrlstructs
Open

Enable runnable (WASM) examples for language.control-structures section#5462
AllenJB wants to merge 4 commits into
php:masterfrom
AllenJB:runnable_lang_ctrlstructs

Conversation

@AllenJB

@AllenJB AllenJB commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Related: #4799

Comment thread language/control-structures/match.xml Outdated
Comment thread language/control-structures/match.xml Outdated
Comment thread language/control-structures/switch.xml Outdated
Comment thread language/control-structures/for.xml
Co-authored-by: Louis-Arnaud <la.catoire@gmail.com>

@jordikroon jordikroon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these examples would really benefit from having a <screen> to see the expected output directly. Would you be able to add those?

Comment thread language/control-structures/break.xml Outdated
Comment thread language/control-structures/for.xml Outdated
Comment thread language/control-structures/while.xml Outdated
…on (review amends: example output, split some examples)
@AllenJB AllenJB requested a review from jordikroon May 8, 2026 14:13
&example.outputs;
<screen>
<![CDATA[
i is equal to 0, 1 or 2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
i is equal to 0, 1 or 2
i is not equal to 0, 1 or 2

for ($i = 0; $i < 5; ++$i) {
if ($i == 2)
continue
continue;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The surrounding text says "Omitting the semicolon after continue… an example of what you shouldn't do", so this example must keep continue without a semicolon to demonstrate the pitfall (continue print "$i\n";). Changing it to continue; makes the code do exactly the "expected" thing, which contradicts the prose. Since the no-semicolon form is a compile error on modern PHP, this snippet should be marked annotations="non-interactive" and reverted to continue (no ;), rather than "fixed".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants