Question


Kaushik

How to remove the last character from string in php ?

Date = 2015-03-24

Comments by experts


Rajesh Kakadiya
Date = 2015-03-24

<?php

$str
="a-b-c-d-f-";
$newtrim($str"-"); // it will remove last character fromstring where "-" is putted
echo $new// Output will be :- "a-b-c-d-e-f"
?>
Rajesh Kakadiya
Date = 2015-03-24

<?php

$strng
"Hey you!";
echo 
rtrim($strng,"you!"); // will remove word from string 
// Output will be :-  Hey
?>


Type your Comment below and click to send comment