function Split_String($txt){ $Split = explode('!', $txt, 2); $new_string = str_replace ("!", "", $Split[1]); return $new_string; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <? function cutword($txt) // ตัดคำ 3 คำแรก { $txt = trim($txt); $array = explode(" ",$txt); $i = 1; foreach($array as $key) { if($i <= 3) { $word .= $key." "; } $i++; } return $word; } //----------------------------------// function Split_String($txt) // โค้ดเก่า { $Split = explode('!', $txt, 2); $new_string = str_replace ("!", "", $Split[1]); return $new_string; } //-----------------------------------// function checkword($txt) // ตรวจสอบเครื่องหมาย ! { $num = strlen($txt); $check = 0; for($i=0;$i<$num;$i++) { $data = substr($txt,$i,1); if($data == "!") { $check = 1; } } //return $check; if($check == 1) // 1 = คือ มีเครื่องหมาย ! 0 = คือ ไม่มี ! { $ase = Split_String($txt); // มีเครื่องหมาย ! } else { $ase = cutword($txt); // ไม่มี ! } return $ase; } //--------------------------------// $txt = " Takara Kabuto Single Speed Road Bike !" ; echo checkword($txt); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง