docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
---
|
||||
id: php-oop-constructor
|
||||
title: "PHP OOP Constructor"
|
||||
category: "Programming_Language"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["__construct()", "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", "oop", "constructor"]
|
||||
raw_sources: ["https://www.w3schools.com/php/php_oop_constructor.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[PHP OOP Constructor]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
`__construct()` eliminates the need to call a separate setter method after object creation — instead of `new Fruit(); $apple->set_details(...)` (two steps), the constructor lets `new Fruit('Apple', 'Red')` initialize properties in ONE step, directly reducing the code from the previous chapter's two-call pattern. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **`__construct($params)`** — a special method automatically invoked whenever `new` creates an object; name starts with double underscore. [S1]
|
||||
- **Accepts arguments** — passed at creation time: `new Fruit("Apple", "Red")`. [S1]
|
||||
- **Purpose** — dynamic initialization, replacing a separate setter call. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Constructor-based initialization: `class Fruit { public $name; public $color; function __construct($name, $color) { $this->name = $name; $this->color = $color; } function get_details() { echo "Name: " . $this->name . ". Color: " . $this->color .".<br>"; } } $apple = new Fruit('Apple', 'Red'); $apple->get_details();`. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
소스에서 모순되는 정보는 발견되지 않음.
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
현재 발견된 실제 적용 사례가 없습니다 — 생성자로 이름/색상을 한 번에 초기화하는 것이 setter 메서드 호출을 줄이는 표준 패턴이다. [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Constructor-based initialization in one step (PHP):
|
||||
```php
|
||||
class Fruit {
|
||||
public $name;
|
||||
public $color;
|
||||
function __construct($name, $color) {
|
||||
$this->name = $name;
|
||||
$this->color = $color;
|
||||
}
|
||||
}
|
||||
$apple = new Fruit('Apple', 'Red'); // initialized directly, no separate setter call
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.90
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[PHP Tutorial]]
|
||||
- **관련 개념:** [[PHP OOP Classes Objects]], [[PHP OOP Destructor]]
|
||||
- **참조 맥락:** 객체 초기화 메서드 — 소멸자(Destructor) 챕터로 직접 이어짐(생성자의 반대 개념).
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — PHP OOP - Constructor Method — https://www.w3schools.com/php/php_oop_constructor.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "PHP OOP Constructor Method" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user