ฟังก์ชั่น strrchr()
ความหมายของฟังก์ชั่นและการใช้งาน
การค้นหาข้อความจากหลังไปหน้า พร้อมคืนค่าตั้งแต่ตำแหน่งที่ถูกพบ โดยต้องคำนึงถึงตัวพิมพ์ใหญ่พิมพ์เล็ก ด้วยฟังก์ชั่น strrchr()
รูปแบบการเขียน (Syntax)
string strrchr ( string $haystack , mixed $needle )
ตัวอย่างที่ 1
<?php
// get last directory in $PATH
$dir = substr(strrchr($PATH, ":"), 1);
// get everything after last newline
$text = "Line 1\nLine 2\nLine 3";
$last = substr(strrchr($text, 10), 1 );
?>