| word_limiter() | ใช้กำหนดให้เหลือ คำตามจำนวนที่กำหนด และต่อท้ายด้วยคำที่กำหนด |
|---|---|
| character_limiter() | ใช้กำหนด ให้เหลือ ตัวอักษร ตามจำนวนที่กำหนด และต่อท้ายด้วยคำที่กำหนด |
| word_wrap() | ใช้ตัดคำขึ้นบรรทัดใหม่ เมื่อครบทุกๆจำนวนตัวอักษรที่กำหนด |
| word_censor() | ใช้ป้องกันคำไม่สุภาพ โดยการ แทนที่คำไม่สุภาพ ด้วยคำที่กำหนด |
| highlight_code() | ใช้กำหนดสีสันให้กับข้อความที่เป็นโค้ด |
| highlight_phrase() | ใช้แทรก tag html ลงไปในคำที่กำหนด |
function:word_limiter ( text, num, suffix )
return type:string
content:ใช้กำหนดให้เหลือ คำตามจำนวนที่กำหนด และต่อท้ายด้วยคำที่กำหนด
example:$data = "Welcome To BambooLabCode dot com"; echo word_limiter ( $data, 3, "..." );
function:character_limiter ( text, num, suffix )
return type:string
content:ใช้กำหนด ให้เหลือ ตัวอักษร ตามจำนวนที่กำหนด และต่อท้ายด้วยคำที่กำหนด
example:$data = "Welcome To BambooLabCode dot com"; echo word_limiter ( $data, 15, "..." );
function:word_wrap ( text, num )
return type:string
content:ใช้ตัดคำขึ้นบรรทัดใหม่ เมื่อครบทุกๆจำนวนตัวอักษรที่กำหนด
example:$data = "Welcome To BambooLabCode dot com"; echo word_wrap ( $data, 5 );
function:word_censor ( text, bad_word, replace_word )
return type:string
content:ใช้ป้องกันคำไม่สุภาพ โดยการ แทนที่คำไม่สุภาพ ด้วยคำที่กำหนด
example:$data = "I love you. I like you. I miss you."; echo word_censor ( $data, array ( "love", "like", "miss" ), "..." );
function:highlight_code ( text_code )
return type:string
content:ใช้กำหนดสีสันให้กับข้อความที่เป็นโค้ด
example:$text = "<? echo \"BambooLabCode\""; echo highlight_code ( $text );
function:highlight_phrase ( text, phrase, open_tag, close_tag )
return type:string
content:ใช้แทรก tag html ลงไปในคำที่กำหนด
example:$text = "I love you."; echo highlight_phrase ( $text, "love", "<span style='color:red;'>", "</span>" );
comment:ตัวแปร text คือ ข้อความที่มีคำที่ต้องการให้ถูกแทรก tag html ตัวแปร phrase คือ ข้อความที่ต้องการให้ถูกแทรก tag html ตัวแปร open_tag คือ tag เปิดที่จะแทรก ตัวแปร close_tag คือ tag ปิดที่จะแทรก