ลบสุดท้ายจดหมาย php
<?php
echo substr('abcdef',0, -1); // abcde
?>
php ลบอักขระสุดท้ายจากข้อความ
$hell = substr('hello', 0, -1);
php substr ลบเมื่อ 4 ตัวอักษร
echo substr($string, 0, -3);
ลบอักขระสุดท้ายจากข้อความใน php
$arrStr = 'Str1, Str2, str3, ';
echo rtrim($arrStr, ", "); //Str1, Str2, str3
echo substr_replace($arrStr, "", -2); //Str1, Str2, str3
echo substr($arrStr, 0, -2); // Str1, Str2, str3
php ลบสุดท้ายอักขระจากข้อความ
//Remove the last character using substr
$string = substr($string, 0, -1);
php ลบอักขระสุดท้ายจากข้อความหาจุลภาค
$string = rtrim($string, ',');