1cfd3bbb56
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
3.0 KiB
3.0 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| php-looping-do-while | PHP Looping Do While | Programming_Language | draft | conceptual |
|
B | 0.9 | 2026-07-04 | 2026-07-04 |
|
|
PHP Looping Do While
🎯 한 줄 통찰 (One-line insight)
The source deliberately shows the SAME do...while loop run twice — once with $i = 1 (condition true from the start) and once with $i = 8 (condition false from the start) — to prove the loop still executes once in both cases, since the condition is checked AFTER the body runs, not before. [S1]
🧠 핵심 개념 (Core concepts)
do { ... } while (condition);— the condition is tested AFTER the code runs, guaranteeing at least one execution. [S1]break/continue— work the same as in while loops. [S1]
📖 세부 내용 (Details)
- Condition true from start:
$i = 1; do { echo $i; $i++; } while ($i < 6);— runs normally. [S1] - Condition false from start (still runs once):
$i = 8; do { echo $i; $i++; } while ($i < 6);— prints 8, then stops (condition already false). [S1] - Break:
$i = 1; do { if ($i == 3) break; echo $i; $i++; } while ($i < 6);. [S1] - Continue:
$i = 0; do { $i++; if ($i == 3) continue; echo $i; } while ($i < 6);. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
- 최소 1회 실행 보장: $i=8로 시작해 조건이 처음부터 거짓이어도 do...while은 최소 한 번은 실행된다는 점이 두 가지 예제 비교로 증명됨. [S1]
🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 조건이 거짓이어도 최소 1회 실행이 필요한 상황(메뉴 표시 등)에 사용된다. [S1]
💻 코드 패턴 (Code patterns)
Do-while runs once even with a false-from-start condition (PHP):
$i = 8;
do {
echo $i; // prints 8
$i++;
} while ($i < 6); // condition already false, but body already ran once
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.90
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: PHP Tutorial
- 관련 개념: PHP Looping While, PHP Looping For
- 참조 맥락: while 루프와의 실행 시점 차이 — for 루프 챕터로 이어짐.
📚 출처 (Sources)
- [S1] W3Schools — PHP do while Loop — https://www.w3schools.com/php/php_looping_do_while.asp
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "PHP do while Loop" page (Astra wiki-curation, P-Reinforce v3.1 format).