/ Published in: PHP
PHPì—ì„œ 사용하기 위한 기본문법
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /**************************/ //ë°°ì—´ì„ ì–¸ë°©ë²• /**************************/ echo $entry[0], ' by ', $entry[2]; //Sample Title by Jason ì´ ì¶œë ¥ë¨ /**************************/ //다른 ë°©ì‹ì˜ ë°°ì—´ì„ ì–¸(Key,Value 스타ì¼) /**************************/ 'title' => 'Sample Title', 'date' => 'April 13,2009' ); echo $entry['title']; //ê²°ê³¼: Sample Title /**************************/ //문ìžì—´ ê²°í•©(String Concatenation) - period(.)으로 ì—°ê²° /**************************/ $foo = "This is a " . "string.!"; echo $foo; /**************************/ //Echoì¶œë ¥ë°©ì‹ ìŒë”°ì˜´í‘œ,í™‘ë”°ì˜´í‘œì— ë”°ë¼ ë‹¬ë¼ì§ /**************************/ $test = "abcde"; echo "hello world $test"; //ê²°ê³¼:hello world abcde echo 'hello world $test'; //ê²°ê³¼:hello world $test /**************************/ //echo를 ì´ìš©í•˜ì—¬ ë°°ì—´ ì¶œë ¥í•˜ê¸°, 중괄호({})를 사용하지 않는 경우ì—는 //ì¸ë±ìŠ¤ì— 홑따옴표가 없는 ê²ƒì— ì£¼ì˜ /**************************/ echo "This Person's name is {$person['name']} and he is $person[age]"; /**************************/ //printf사용구문 /**************************/ $amt1 = 2.55; $amt2 = 3.55; $total = $amt1 + $amt2; $string = "변수입니닷."; echo "ì´ ê°€ê²©ì€ $",$total, "<br />"; />