toggle menu

How to remove last character from string in php?

Dhananjay Kumar |21 Mar at 07:03

I have a query to remove last char in my dynamic string. Like if "abc" than result is "ab" , "xyzzzz" than "xyzzz"

  • 4 likes
  • 1 comment

Rajesh Kumar21 Mar at 03:03

$str = 'abc';
echo substr($str,0,-1);

Posted:

21 Mar at 07:03

Viewed:

1571 times

Active:

23 Mar at 11:03