--- id: php-math title: "PHP Math" 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", "math"] raw_sources: ["https://www.w3schools.com/php/php_math.asp"] applied_in: [] github_commit: "" --- # [[PHP Math]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) `rand()` accepts optional min/max parameters that fundamentally change its behavior β€” bare `rand()` returns an arbitrary-range random number, while `rand(10, 100)` constrains the result to an inclusive range, making the two-argument form the one actually usable for bounded scenarios like dice rolls or ID generation. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`pi()`** β€” returns the value of Ο€. [S1] - **`min()` / `max()`** β€” lowest/highest value among a list of arguments. [S1] - **`abs()`** β€” absolute (positive) value. [S1] - **`sqrt()`** β€” square root. [S1] - **`round()`** β€” rounds a float to the nearest integer. [S1] - **`rand()`** β€” random number; optional `(min, max)` params bound the range (inclusive). [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Pi: `echo(pi());`. [S1] - Min/max: `echo(min(0, 150, -8, -200)); echo(max(0, 150, -8, -200));`. [S1] - Absolute value: `echo(abs(-6.7)); // 6.7`. [S1] - Square root: `echo(sqrt(64)); // 8`. [S1] - Rounding: `echo(round(3.60)); echo(round(0.49));`. [S1] - Bounded random: `echo(rand(10, 100)); // between 10 and 100 inclusive`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” rand(10, 100)처럼 λ²”μœ„ μ§€μ • λ‚œμˆ˜ 생성이 κ²Œμž„/좔첨 λ“± μ‹€μ „μ—μ„œ 자주 쓰인닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Bounded random integer (PHP): ```php echo(rand(10, 100)); // random integer between 10 and 100 inclusive ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[PHP Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[PHP Numbers]], [[PHP Casting]], [[PHP Constants]] - **μ°Έμ‘° λ§₯락:** μˆ˜ν•™ ν•¨μˆ˜ λͺ¨μŒ β€” μƒμˆ˜(Constants) μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” PHP Math Functions β€” https://www.w3schools.com/php/php_math.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "PHP Math Functions" page (Astra wiki-curation, P-Reinforce v3.1 format).