ลบอักขระหนึ่งตัวจากด้านหลังของสตริงใน PHP
<?php
$string = "abcdef";
$new_string = substr($string, 0, -1); // ตัดอักขระตัวสุดท้ายออก
echo $new_string; // แสดงผลลัพธ์: abcde
?>
<?php
$string = "abcdef";
$new_string = substr($string, 0, -1); // ตัดอักขระตัวสุดท้ายออก
echo $new_string; // แสดงผลลัพธ์: abcde
?>
ปิดความเห็นแล้ว