| limit_words() | ใช้คืนค่า ข้อความ ตามจำนวนที่กำหนด ( limit ) จากประโยคที่กำหนด ( text ) และเพิ่มคำปิดท้าย ( end ) |
|---|---|
| limit_chars() | ใช้คืนค่า ข้อความ ตามจำนวนตัวอักษรที่กำหนด ( limit ) จากประโยคที่กำหนด ( text ) และเพิ่มคำปิดท้าย ( end ) |
| random() | ใช้สุ่มข้อความ ตามชนิดที่กำหนด ตามจำนวนที่กำหนด |
| reduce_slashes() | ใช้ลดเครื่องหมาย slashes ให้เหลือ 1 ตัว ในกรณีที่มีเครื่องหมาย slashes ติดกันมากกว่า 1 ตัว |
| censor() | ใช้แทนที่คำ |
method:limit_words ( text, limit, end );
return type:string
special:static
content:ใช้คืนค่า ข้อความ ตามจำนวนที่กำหนด ( limit ) จากประโยคที่กำหนด ( text ) และเพิ่มคำปิดท้าย ( end )
example:$text = "Today, Begin of war of the world."; echo text::limit_words ( $text, 4, "...." );
method:limit_chars ( text, limit, end );
return type:string
special:static
content:ใช้คืนค่า ข้อความ ตามจำนวนตัวอักษรที่กำหนด ( limit ) จากประโยคที่กำหนด ( text ) และเพิ่มคำปิดท้าย ( end )
example:$text = "Today, Begin of war of the world."; echo text::limit_words ( $text, 18, "...." );
method:random ( type, length );
return type:string
special:static
content:ใช้สุ่มข้อความ ตามชนิดที่กำหนด ตามจำนวนที่กำหนด
example:echo text::random ( "alnum", 30 );
comment:ตัวแปร type ให้กำหนดว่าจะสุ่มตัวอักษรชนิดไหนบ้าง ได้แก่ alnum คือ 0-9, a-z, A-Z alpha ได้แก่ a-z, A-Z numeric ได้แก่ 0-9 nozero ได้แก่ 1-9
method:reduce_slashes ( string );
return type:string
special:static
content:ใช้ลดเครื่องหมาย slashes ให้เหลือ 1 ตัว ในกรณีที่มีเครื่องหมาย slashes ติดกันมากกว่า 1 ตัว
example:$text = "control//method//argument"; echo text::reduce_slashes ( $text );
method:censor ( text, array_bad_word, replace, boolean );
return type:string
special:static
content:ใช้แทนที่คำ
example:$array_bad_word = array ( "sing", "leo" ); $text = "I sell sing and leo bier."; echo text::censor ( $text, $array_bad_word, "*", true );
comment:ตัวแปร text คือประโยคที่จะถูกค้นหา และถูกแทนที่ ตัวแปร array_bad_word คือกำหนดข้อความที่จะถูกค้นหา ตัวแปร replace คือคำที่จะนำมาแทนที่ ตัวแปร boolean คือกำหนด true หมายความว่าจะค้นหาแบบเป็นคำหรือไม่