---
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).