ขอเผยแผ่เป็นธรรมทาน เพื่อการหลุดพ้นจากวัฏสงสารอันหาต้นและปลายไม่ได้
space
space
space
<<
สิงหาคม 2551
 12
3456789
10111213141516
17181920212223
24252627282930
31 
space
space
7 สิงหาคม 2551
space
space
space

การใช้งานฟังก์ชั่น strpos ใน PHP
การใช้งาน ฟังก์ชั่น strpos

รายละเอียด :

ฟังก์ชั่นนี้ มีหน้าที่ค้นหาตำแหน่งของ string ครับ เมื่อเรียกใช้ฟังก์ชั่น strpos
ถ้าฟังก์ชั่นนี้ทำงานสำเร็จจะ return ค่าตำแหน่งของ string ที่เราค้นหาคืนมา
แต่ถ้าหาไม่เจอจะ return ค่า FALSE กลับมาครับ ดูตามตัวอย่างเลยครับ



//ตัวอย่างการใช้งานฟังก์ชั่น strpos

$string = 'blog.deveak.com';
$find = 'a';
$pos = strpos($string, $find);

//ถ้าไม่เจอจะคือค่า FALSE กลับมา
if ($pos === false) {
echo "The string '$find' was not found in the string '$string'";
} else {
echo "The string '$find' was found in the string '$string'";
echo " and exists at position $pos";
}

?>



Create Date : 07 สิงหาคม 2551
Last Update : 7 สิงหาคม 2551 19:37:36 น. 0 comments
Counter : 850 Pageviews.

ชื่อ : * blog นี้ comment ได้เฉพาะสมาชิก
Comment :
  *ส่วน comment ไม่สามารถใช้ javascript และ style sheet
 
space

eaknarak
Location :
กรุงเทพ Thailand

[ดู Profile ทั้งหมด]

ฝากข้อความหลังไมค์
Rss Feed
Smember
ผู้ติดตามบล็อก : 1 คน [?]







space
space
space
space
[Add eaknarak's blog to your web]
space
space
space
space
space