php / php/doc-en

Wrong result in complex comparisons switch's example's result

Open
#1,682 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

From manual page: https://php.net/control-structures.switch

Where it reads:
For more complex comparisons, the value true may be used as the switch value. Or, alternatively, if-else blocks instead of switch.

The example's result is:
// Prints "C"

Shouldn't it be?:
// Prints "B"

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the control-structures.switch manual page linked in the issue and locate the section on using true for complex comparisons. Check the example against its stated conditions and output. Done means the documented result matches the example's actual behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.