--- id: php-syntax title: "PHP Syntax" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["PHP κΈ°λ³Έ 문법"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.9 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["php", "programming", "w3schools", "syntax"] raw_sources: ["https://www.w3schools.com/php/php_syntax.asp"] applied_in: [] github_commit: "" --- # [[PHP Syntax]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) PHP's case-sensitivity is asymmetric β€” keywords/functions/classes are case-INsensitive (`ECHO` works same as `echo`), but variable names are strictly case-SENSITIVE (`$color` and `$COLOR` are two completely different variables), a distinction the source demonstrates directly by showing the second echo silently printing nothing meaningful. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **PHP tags** β€” a script starts with ``. [S1] - **`.php` extension** β€” default file extension; files mix HTML and PHP code freely. [S1] - **Semicolons required** β€” all PHP statements end with `;`. [S1] - **Case-insensitive**: keywords, function names, class names, user-defined functions. [S1] - **Case-sensitive**: variable names. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Basic script structure: `` embedded inside HTML. [S1] - Keyword case-insensitivity: `ECHO 'Hello World!
'; echo 'Hello World!
';` β€” both legal and equivalent. [S1] - Variable case-sensitivity: `$color = "red"; echo "My car is $color
"; echo "My house is $COLOR";` β€” `$COLOR` is undefined/different from `$color`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **λŒ€μ†Œλ¬Έμž κ΅¬λΆ„μ˜ λΉ„λŒ€μΉ­μ„±**: ν‚€μ›Œλ“œ/ν•¨μˆ˜/ν΄λž˜μŠ€λŠ” λŒ€μ†Œλ¬Έμž ꡬ뢄 μ—†μŒ, ν•˜μ§€λ§Œ λ³€μˆ˜λͺ…은 λŒ€μ†Œλ¬Έμž ꡬ뢄됨이 λͺ…μ‹œμ μœΌλ‘œ λŒ€λΉ„λ¨. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” HTMLκ³Ό PHP μ½”λ“œλ₯Ό ν•œ νŒŒμΌμ—μ„œ ν˜Όν•©ν•˜λŠ” 것이 PHP 슀크립트의 κΈ°λ³Έ μž‘μ„± 방식이닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Variable name case-sensitivity trap (PHP): ```php "; // red echo "My house is $COLOR"; // undefined β€” $COLOR != $color ?> ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[PHP Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[PHP Install]], [[PHP Comments]], [[PHP Variables]] - **μ°Έμ‘° λ§₯락:** PHP κΈ°λ³Έ 문법 β€” 주석(Comments), λ³€μˆ˜(Variables) μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” PHP Syntax β€” https://www.w3schools.com/php/php_syntax.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "PHP Syntax" page (Astra wiki-curation, P-Reinforce v3.1 format).