String Function
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:05 |
function:chr ( int ); return type:string content:ใช้แปลง ascii เป็น ตัวอักษร example:echo chr ( 65 );
|
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:06 |
function:ord ( string ); return type:int content:ใ้ช้แปลง ตัวอักษร เป็น ascii example:echo ord ( "A" );
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:07 |
function:strtoupper ( string ); return type:string content:ใช้แปลง ตัวอักษร เป็น ตัวพิมพ์ใหญ่ทั้งหมด example:echo strtoupper ( "design-dd" );
|
|
Last Updated ( Monday, 26 April 2010 13:08 )
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:07 |
function:strtolower ( string ); return type:string content:ใช้แปลง ตัวอักษร เป็น ตัวพิมพ์เล็กทั้งหมด example:echo strtolower ( "design-DD.Com" );
|
|
Last Updated ( Monday, 26 April 2010 13:09 )
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:09 |
function:ucfirst ( string ); return type:string content:ใช้แปลง ตัวอักษร ตัวแรกสุดของข้อความ ให้เป็น ตัวพิมพ์ใหญ่ example:echo ucfirst ( "design-dd" );
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:10 |
function:ucwords ( string ); return type:string content:ใช้แปลง ตัวอักษร ตัวแรกสุดของแต่ละคำ ให้เป็นตัวพิมพ์ใหญ่ example:echo ucwords ( "design-dd" );
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:10 |
function:trim ( string ); return type:string content:ใช้ตัดช่องว่าง ทางด้านซ้ายและด้านขวา ออก example:echo trim ( " design-dd " );
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:11 |
function:ltrim ( string ); return type:string content:ใช้ตัดช่องว่าง ทางด้านซ้าย ออก example:echo ltrim ( " design-dd " );
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:11 |
function:rtrim ( string ); return type:string content:ใช้ตัดช่องว่าง ทางด้านขวา ออก example:echo rtrim ( " design-dd " );
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:12 |
function:chop ( string ) return type:string content:ใช้ตัดช่องว่าง ทางด้านขวา ออก example:echo chop ( " design-dd " );
|
|
Written by รับทำเว็บไซต์
|
|
Monday, 26 April 2010 13:14 |
function:substr_count ( string, find ); return type:int content:ใช้นับจำนวน ตัวอักษรที่กำหนดใน string example:echo substr_count ( "design-dd", "b" );
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:06 |
function:str_word_count ( string, format ); return type:int, array content:กรณีที่ไม่กำหนดค่าของ format จะใช้นับจำนวนคำ กรณีที่กำหนดค่าของ format จะเก็บ คำแต่ละคำ ไว้ใน array แล้วคืนค่ามาให้ example:echo str_word_count ( "design-dd" ); print_r ( str_word_count ( "design-dd", 1 ) ); comment:ถ้า format = 1 จะคืนค่า array ที่มี key เริ่มจาก 0 เรียงมาเรืื่อยๆ ถ้า format = 2 จะคืนค่า array ที่มี key คือ ตำแหน่งเริ่มต้นของคำนั้นๆ
|
|
Last Updated ( Tuesday, 27 April 2010 17:07 )
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:06 |
function:count_chars ( string, mode ); return type:array content:ใช้นับจำนวนตัวอักษรแต่ละตัวใน string example:$arr_word = count_chars ( "design-dd" ); print_r ( $arr_word ); comment:ถ้า mode = 0 จะมีคีย์คือรหัส ascii ตั้งแต่ 0 ถึง 255 ( default ) ถ้า mode = 1 จะมีคีย์คือรหัส ascii เฉพาะค่าที่มีความถี่ ( คือเฉพาะตัวอักษรที่มี ) ถ้า mode = 2 จะมีคีย์คือรหัส ascii เฉพาะค่าที่ไม่มีความถี่ ( คือเฉพาะตัวอักษรที่ไม่มี )
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:07 |
|
function:implode ( separator, array ); return type:string content:ใช้รวมค่าของ array ไว้ในตัวแปร string โดยมีตัวคั่นตามที่กำหนด example:$arr = array( "design-dd", "lab", "code" ); echo implode ( ", ", $arr );
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:08 |
|
function:join ( separator, array ); return type:string content:ใช้รวมค่าของ array ไว้ในตัวแปร string โดยมีตัวคั่นตามที่กำหนด example:$arr = array( "design-dd", "lab", "code" ); echo implode ( ", ", $arr );
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:08 |
|
function:explode ( separator, stinrg, limit ); return type:array content:ใช้แยกค่าของ string แล้วเก็บไว้ที่ array ( แยกตามตัวแบ่ง ) example:$string = "design-dd"; $arr = explode ( " ", $string ); print_r ( $arr ); comment:ค่า limit คือจำกัดคำที่จะได้
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:11 |
function:str_split ( string, length ); return type:array content:ใช้แบ่งค่าของ string แล้วเก็บไว้ที่ array โดยแต่ละส่วนจะถูกแบ่ง ตามจำนวนที่กำหนด ( length ) example:$string = "design-dd"; $arr = str_split ( $string, 2 ); print_r ( $arr );
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:12 |
function:chunk_split ( string, posit, value ); return type:string content:ใช้แทรกข้อความที่กำหนด ( value ) ในทุกๆตำแหน่งที่กำหนดลงใน string example:$string = "400230460"; echo chunk_split ( $string, 3, "," );
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:13 |
function:str_pad ( string, length, value, type ); return type:string content:ใช้แทรกข้อความ ( value ) เข้าไปใน string เพื่อให้มีขนาดเท่ากับที่กำหนด ( length ) example:$string = "700"; echo str_pad ( $string, 5, " ", STR_PAD_LEFT ); echo str_pad ( $string, strlen ( $string ) + 3, ".00", STR_PAD_RIGHT ); comment:ถ้า type = STR_PAD_RIGHT คือ เพิ่มทางขวา ( default ) ถ้า type = STR_PAD_LEFT คือ เพิ่มทางซ้าย ถ้า type = STR_PAD_BOTH คือ เพิ่มทั้งทางซ้ายและทางขวา
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:13 |
function:parse_str ( string, array ); return type:void content:ใช้แยกค่าของ string ที่ส่งมาแบบ GET และเก็บไว้ที่ตัวแปร array โดยมีเครื่องหมาย & เป็นตัวแยก example:$string = "title=bamboo&name[]=panda&name[]=labcode"; parse_str ( $string, $get ); echo "Title : " . $get["title"]; echo "Name : " . $get["name"][0] . " and " . $get["name"][1];
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:13 |
function:strtok ( string, token ); return type:string content:ใช้แยกค่าของ string โดยมีตัวแยกตามที่กำหนด ( token ) และจะคืนค่าคำที่ถูกแยกออกมา และคัดคำนั้นทิ้งออกจาก string example:$token = strtok ( "bamboo lab code", " " ); while ( $token ) { echo $tok . "<br/>"; $token = strtok ( " " ); }
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:13 |
function:strrev ( string ); return type:string content:ใช้สลับตัวอักษร จากหน้าไปหลัง จากหลังไปหน้า example:echo strrev ( "design-dd" );
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:14 |
function:str_shuffle ( string ) return type:string content:ใช้สลับตัวอักษร แบบสุ่ม example:echo str_shuffle ( "design-dd" );
|
|
Written by รับทำเว็บไซต์
|
|
Tuesday, 27 April 2010 17:15 |
function:strlen ( string ); return type:int content:ใช้นับจำนวนตัวอักษรทั้งหมด example:echo strlen ( "design-dd" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 14:59 |
function:strcmp ( string1, string2 ); return type:int content:ใช้เปรียบเทียบข้อความ 2 ข้อความ โดยคำนึงถึงตัวพิมพ์ใหญ่เล็กด้วย example:echo strcmp ( "manutd", "manUTD" ); comment:คืนค่า -1 แสดงว่า string1 < string2 คืนค่า 0 แสดงว่า string1 = string2 คืนค่า 1 แสดงว่า string1 > string2
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:00 |
function:strcasecmp ( string1, string2 ); return type:int content:ใช้เปรียบเทียบข้อความ 2 ข้อความโดยไม่คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก example:echo strcasecmp ( "manutd", "ManUTD" ); comment:คืนค่า -1 แสดงว่า string1 < string2 คืนค่า 0 แสดงว่า string1 = string2 คืนค่า 1 แสดงว่า string1 > string2
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:00 |
function:strncmp ( string1, string2, length ); return type:int content:ใช้เปรียบเทียบข้อความ 2 ข้อความ โดยคำนึงถึงพิมพ์ใหญ่พิมพ์เล็ก และมีการกำหนดจำนวนตัวอักษรที่จะนำมาเปรียบเทียบด้วย ( ใช้ algorithm ของ natural order ) example:echo strncmp ( "manutd", "manUTD", 3 ); comment:คืนค่า -1 แสดงว่า string1 < string2 คืนค่า 0 แสดงว่า string1 = string2 คืนค่า 1 แสดงว่า string1 > string2
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:01 |
function:strncasecmp ( string1, string2, length ); return type:int content:ใช้เปรียบเทียบข้อความ 2 ข้อความ โดยไม่คำนึงถึงพิมพ์ใหญ่พิมพ์เล็ก และมีการกำหนดจำนวนตัวอักษรที่จะนำมาเปรียบเทียบด้วย ( ใช้ algorithm ของ natural order ) example:echo strncasecmp ( "manutd", "ManUTD", 3 ); comment:คืนค่า -1 แสดงว่า string1 < string2 คืนค่า 0 แสดงว่า string1 = string2 คืนค่า 1 แสดงว่า string1 > string2
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:01 |
function:strnatcmp ( string1, string2 ); return type:int content:ใช้เปรียบเทียบข้อความ 2 ข้อความ โดยคำนึงถึงพิมพ์ใหญ่พิมพ์เล็ก ( ใช้ algorithm ของ natural order ) example:echo strnatcmp ( "manutd", "manUTD" ); comment:คืนค่า -1 แสดงว่า string1 < string2 คืนค่า 0 แสดงว่า string1 = string2 คืนค่า 1 แสดงว่า string1 > string2
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:01 |
function:strnatcasecmp ( string1, string2 ); return type:int content:ใช้เปรียบเทียบข้อความ 2 ข้อความ โดยไม่คำนึงถึงพิมพ์ใหญ่พิมพ์เล็ก ( ใช้ algorithm ของ natural order ) example:echo strnatcasecmp ( "manutd", "ManUTD" ); comment:คืนค่า -1 แสดงว่า string1 < string2 คืนค่า 0 แสดงว่า string1 = string2 คืนค่า 1 แสดงว่า string1 > string2
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:01 |
function:similar_text ( string1, string2, percent ); return type:void content:ใช้เปรียบเทียบข้อความ 2 ข้อความ โดยจะตรวจสอบว่ามีความเหมือนกันกี่เปอร์เซ็นต์ และเก็บไว้ที่ตัวแปร percent example:similar_text ( "manutd", "mancity", $percent ); echo $percent;
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:01 |
function:levenshtein ( string1, string2 ); return type:int content:ใช้เปรียบเทียบข้อความ 2 ข้อความ โดยจะคืนค่าจำนวนของตัวอักษรที่แตกต่างกัน example:echo levenshtein ( "manutd", "mancity" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:02 |
function:substr_compare ( string1, string2, start, length, case ); return type:int content:ใช้เปรียบเทียบข้อความ 2 ข้อความ โดยมีการกำหนดตำแหน่งเริ่มต้นที่จะเปรียบเทียบ และจำนวนที่จะเปรียบเทียบ example:$string1 = "design-DD"; $string2 = "webdesign"; echo substr_compare ( $string1, $string2, 3, 6 ); comment:ถ้า case = false คือ คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก ( default ) ถ้า case = true คือ ไม่คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก
คืนค่า -1 แสดงว่า string1 < string2 คืนค่า 0 แสดงว่า string1 = string2 คืนค่า 1 แสดงว่า string1 > string2
|
|
Last Updated ( Wednesday, 28 April 2010 15:10 )
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:07 |
function:strpos ( string, find, start ); return type:int content:ใช้ค้นหาข้อความที่กำหนดใน string จากหน้าไปหลัง โดยจะคืนค่าตำแหน่งแรกที่พบ หรือคืนค่า false ถ้าไม่พบ ( การค้นหานี้คำนึงถึงตัวพิมพ์เล็กพิมพ์ใหญ่ ) example:echo strpos ( "design-DD", "e" ); comment:start ถ้าไม่กำหนดคือจะเริ่มจากตำแหน่งแรก
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:12 |
function:stripos ( string, find, start ); return type:int content:ใช้ค้นหาข้อความที่กำหนดใน string จากหน้าไปหลัง โดยจะคืนค่าตำแหน่งแรกที่พบ หรือคืนค่า false ถ้าไม่พบ ( การค้นหานี้ไม่คำนึงถึงตัวพิมพ์เล็กพิมพ์ใหญ่ ) example:echo stripos ( "design-DD", "E", 0 ); comment:start ถ้าไม่กำหนดคือจะเริ่มจากตำแหน่งแรก
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:24 |
function:strrpos ( string, find, start ); return type:int content:ใช้ค้นหาข้อความที่กำหนดใน string จากหลังมาหน้า โดยจะคืนค่าตำแหน่งแรกที่พบ หรือคืนค่า false ถ้าไม่พบ ( การค้นหานี้คำนึงถึงตัวพิมพ์เล็กพิมพ์ใหญ่ ) example:echo strrpos ( "design-DD", "e", 12 ); comment:start ถ้าไม่กำหนดคือจะเริ่มจากตำแหน่งสุดท้าย
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:25 |
function:strripos ( string, find, start ); return type:int content:ใช้ค้นหาข้อความที่กำหนดใน string จากหลังมาหน้า โดยจะคืนค่าตำแหน่งแรกที่พบ หรือคืนค่า false ถ้าไม่พบ ( การค้นหานี้ไม่คำนึงถึงตัวพิมพ์เล็กพิมพ์ใหญ่ ) example:echo strripos ( "design-DD", "E", 12 ); comment:start ถ้าไม่กำหนดคือจะเริ่มจากตำแหน่งสุดท้าย
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:26 |
function:strspan ( string1, string2, start, length ); return type:int content:ใช้เปรียบข้อความ 2 ข้อความ โดยจะคืนค่าตำแหน่งแรกที่ข้อความทั้งสองไม่ตรงกัน example:echo strspan ( "ManUtd", "ManCity" ); comment:start จะเริ่มนับจาก 1 length ถ้าไม่กำหนดคือเปรียบเทียบทั้งหมด
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:27 |
function:str_replace ( string, find, replace ); return type:string content:ใช้ค้นหาข้อความที่กำหนด ( find ) ใน string และแทนที่ (replace ) คำนั้นด้วย โดยการค้นหาคำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก example:echo str_replace ( "ManUTD", "UTD", "City" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:27 |
function:str_ireplace ( string, find, replace ); return type:string content:ใช้ค้นหาข้อความที่กำหนด ( find ) ใน string และแทนที่ (replace ) คำนั้นด้วย โดยการค้นหาไม่คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก example:echo str_ireplace ( "Manutd", "UTD", "City" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:27 |
function:strtr ( string, find, replace ); return type:string content:ใช้ค้นหาข้อความที่กำหนด ( find ) ใน string และแทนที่ (replace ) คำนั้นด้วย โดยการแทนที่คำนั้นจะเป็นการแทนที่แบบตัวต่อตัว คือถ้าส่วนไหนเกินก็จะไม่มีผลต่อการแทนที่ example:echo strtr ( "ManUTD", "UTD", "City" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:30 |
function:substr_replace ( string, replace, start ); return type:string content:ใช้แทนที่ข้อความใน string โดยเริ่มแทนตั้งแต่ตำแหน่งที่กำหนด example:echo substr_replace ( "bamboolabcode.co.th", "com", 13 );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:31 |
function:strpbrk ( string, find ); return type:string content:ใช้ค้นหาข้อความที่กำหนด ( find ) ใน string และจะคืนค่าข้อความตั้งแต่ตำแหน่งที่พบจนหมด หรือคืนค่า false ถ้าไม่พบข้อความ ( การค้นหานี้คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก ) example:echo strpbrk ( "design-dd", "l" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:31 |
function:strchr ( string, find ); return type:string content:ใช้ค้นหาข้อความที่กำหนด ( find ) ใน string และจะคืนค่าข้อความตั้งแต่ตำแหน่งที่พบจนหมด หรือคืนค่า false ถ้าไม่พบข้อความ ( การค้นหานี้คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก ) example:echo strchr ( "design-DD", "l" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:32 |
function:strstr ( string, find ); return type:string content:ใช้ค้นหาข้อความที่กำหนด ( find ) ใน string และจะคืนค่าข้อความตั้งแต่ตำแหน่งที่พบจนหมด หรือคืนค่า false ถ้าไม่พบข้อความ ( การค้นหานี้คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก ) example:echo strstr ( "design-dd", "l" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:33 |
function:stristr ( string, find ); return type:string content:ใช้ค้นหาข้อความที่กำหนด ( find ) ใน string และจะคืนค่าข้อความตั้งแต่ตำแหน่งที่พบจนหมด หรือคืนค่า false ถ้าไม่พบข้อความ ( การค้นหานี้ไม่คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก ) example:echo stristr ( "Design-DD", "l" );
|
|
Written by รับทำเว็บไซต์
|
|
Wednesday, 28 April 2010 15:34 |
function:strrchr ( string, find ); return type:string content:ใช้ค้นหาข้อความที่กำหนด ( find ) ใน string และจะคืนค่าข้อความตั้งแต่ตำแหน่งที่พบจนหมด หรือคืนค่า false ถ้าไม่พบข้อความ ( การค้นหานี้คำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก ) เป็นการค้นหาจากข้างหลังมาข้างหน้า example:echo strrchr ( "design-dd", "l" );
|
|
Written by นักออกแบบเว็บ
|
|
Saturday, 01 May 2010 04:01 |
function:substr ( string, start, length ); return type:string content:ใช้ดึงข้อความตั้งแต่ตำแหน่งที่กำหนด ตามจำนวนที่กำหนด example:echo substr ( "design-dd", 6 ); comment:length ถ้าไม่กำหนดแสดงว่าดึงจนหมด length ถ้ากำหนดเป็นตัวเลขติดลบ แสดงว่าดึงจากข้างหลังมาข้างหน้า
|
|
Written by นักออกแบบเว็บ
|
|
Saturday, 01 May 2010 04:11 |
function:str_repeat ( string, count ); return type:string content:ใช้แสดงค่า string ซ้ำๆกันตามจำนวนที่กำหนด example:echo str_repeat ( "design-dd", 3 );
|
|
Written by นักออกแบบเว็บ
|
|
Saturday, 01 May 2010 04:12 |
function:wordwrap ( string, width, break, cut ); return type:string content:ใช้กำหนดให้มีการตัดคำขึ้นบรรทัดใหม่ example:$string = "design-dd php html css"; echo wordwrap ( $string, 8, "\n", 1 ); comment:width ใช้กำหนดขนาดความยาวของแต่ละบรรทัด break ใช้กำหนดข้อความแสดงการขึ้นบรรทัดใหม่ cut ถ้าเท่ากับ 0 คือเมื่อข้อความครบจำนวนที่กำหนดแล้ว จะยังไม่ตัดคำจนกว่าจะหมดคำ cut ถ้าเท่ากับ 1 คือให้ตัดคำขึ้นบรรทัดใหม่ทันที เมื่อข้อความครบจำนวนที่กำหนด
|
|
Written by นักออกแบบเว็บ
|
|
Saturday, 01 May 2010 04:16 |
function:htmlspecialchars ( string, style, charset ); return type:string content:ใช้แปลงเครื่องหมายพิเศษต่างๆที่ตรงกับ tag ของภาษา html ใช้เป็นรหัสอักษรที่ใช้ในภาษา html เช่น จาก "<" เป็น "<" example:echo htmlspecialchars ( "<b>design-dd</b>" ); comment:style คือรูปแบบการเปลี่ยนเครื่องหมายคำพูด ถ้า style = ENT_COMPAT คือกำหนดให้แปลงเครื่องหมาย double quote แค่คง single quote ไว้ ( default ) ถ้า style = ENT_QUOTES คือกำหนดให้แปลงทั้งเครื่องหมาย double quote และ single quote ถ้า style = ENT_NOQUOTES คือกำหนดไม่ให้แปลงทั้งเครื่องหมาย double quote และ single quote
charset default คือ ISO-8859-1
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:01 |
function:htmlentities ( string, style, charset ); return type:string content:ใช้แปลงเครื่องหมายพิเศษต่างๆที่ตรงกับ tag ของภาษา html ใช้เป็นรหัสอักษรที่ใช้ในภาษา html เช่น จาก "<" เป็น "<" example:echo htmlentities ( "<b>design-DD</b>" ); comment:style คือรูปแบบการเปลี่ยนเครื่องหมายคำพูด ถ้า style = ENT_COMPAT คือกำหนดให้แปลงเครื่องหมาย double quote แค่คง single quote ไว้ ( default ) ถ้า style = ENT_QUOTES คือกำหนดให้แปลงทั้งเครื่องหมาย double quote และ single quote ถ้า style = ENT_NOQUOTES คือกำหนดไม่ให้แปลงทั้งเครื่องหมาย double quote และ single quote
charset default คือ ISO-8859-1
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:02 |
function:html_entity_decode ( string, style, charset ); return type:string content:ใช้แปลงรหัสอักษรของภาษา html ให้เป็นเครื่องหมายพิเศษตามปกติ เช่นจาก "<" เป็น "<" example:$string = htmlentities ( "<b>design-DD</b>" ); echo html_entity_decode ( $string ); comment:style คือรูปแบบการเปลี่ยนเครื่องหมายคำพูด ถ้า style = ENT_COMPAT คือกำหนดให้แปลงเครื่องหมาย double quote แค่คง single quote ไว้ ( default ) ถ้า style = ENT_QUOTES คือกำหนดให้แปลงทั้งเครื่องหมาย double quote และ single quote ถ้า style = ENT_NOQUOTES คือกำหนดไม่ให้แปลงทั้งเครื่องหมาย double quote และ single quote
charset default คือ ISO-8859-1
|
|
get_html_translation_table() |
|
|
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:02 |
function:get_html_translation_table ( table, style ); return type:array content:ใช้คืนค่าเครื่องหมายพิเศษของภาษา html ทั้งหมด เช่น "<" example:print_r ( get_html_translation_table () ); comment:ถ้า table = HTML_SPECIALCHARS จะแสดงเครื่องหมายพิเศษที่ใช้กับ htmlspecialchars() ( default ) ถ้า table = HTML_ENTITIES จะแสดงเรื่องหมายพิเศษที่ใช้กับ htmlentities()
style คือรูปแบบการเปลี่ยนเครื่องหมายคำพูด ถ้า style = ENT_COMPAT คือกำหนดให้แปลงเครื่องหมาย double quote แค่คง single quote ไว้ ( default ) ถ้า style = ENT_QUOTES คือกำหนดให้แปลงทั้งเครื่องหมาย double quote และ single quote ถ้า style = ENT_NOQUOTES คือกำหนดไม่ให้แปลงทั้งเครื่องหมาย double quote และ single quote
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:04 |
function:nl2br ( string ); return type:string content:ใช้แปลงการขึ้นบรรทัดใหม่ "\n" เป็น "<br/>" example:$string = "Bamboo\n Labcode"; echo nl2br ( $string ); comment:การขึ้นบรรทัดใหม่ทุกครั้งจะมีคำสั่ง "\n" ซ่อนอยู่ นิยมใช้กับข้อมูลที่มีจำนวนหลายบรรทัด เช่น <textarea>
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:04 |
function:strip_tags ( string, tags ); return type:string content:ใช้ลบ tag ของภาษา html ออกไป example:$string = "<b><small><font color="red">bamboolabcode</font></small></b>"; echo strip_tags ( $string, "<small>" ); echo strip_tags ( $string, "<b><small>" ); comment:tags คือกำหนด tags ที่ต้องการลบออก
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:05 |
function:quotemeta ( string ); return type:string content:ใช้เพิ่มเครื่องหมาย backslashes (\) หน้าตัวอักษรที่เป็น Meta Characters ( ได้แก่ . \ + * ? [ ] ( ) ^ $ ) example:echo quotemeta ( " [design-DD ] " );
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:06 |
function:addslashes ( string ); return type:string content:ใช้เพิ่มเครื่องหมาย backslashes (\) หน้าตัวอักษร ได้แก่ double quote, single quote, backslashes, null เพื่อป้องกันความผิดพลาด example:echo addslashes ( "C:\PHP" );
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:06 |
function:addcslashes ( string, charlist ); return type:string content:ใช้เพิ่มเครื่องหมาย backslashes (\) หน้าตัวอักษร ได้แก่ double quote, single quote, backslashes, null และยังสามารถกำหนดให้อยู่หน้า Escape และตัวอักษรที่เป็นช่วงอีกด้วย เพื่อป้องกันความผิดพลาด example:echo addcslashes ( "C:\PHP", "A..z" );
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:06 |
function:stripslashes ( string ); return type:string content:ใช้ลบเครื่องหมาย backslashes ( \ ) ออก example:echo stripslashes ( "C:\PHP" );
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:06 |
function:stripcslashes ( string ); return type:string content:ใช้ลบเครื่องหมาย backslashes ( \ ) ออก example:echo stripcslashes ( "C:\PHP" );
|
|
Written by นักออกแบบเว็บ
|
|
Tuesday, 04 May 2010 20:07 |
function:number_format ( number, after, break, thousand ); return type:string content:ใช้จัดรูปแบบการแสดงผลข้อมูลตัวเลข example:$num = 10000.467; echo number_format ( $num, 2, ".", "," ); comment:after คือกำหนดจำนวนตัวเลขหลังจุดทศนิยม break คือกำหนดเครื่องหมายแทนจุดทศนิยม thousand คือกำหนดเครื่องหมายแยกหลักพัน
|
|
|
|
|
|
เราแบ่งปันสิ่งดีๆ ให้กัน
|