Browsing:

Tag: remove last char

Remove Last Character from String in PHP

Hello friends, Here We describes 3 methods to remove last character from a string in PHP programming language. You can use any one methods according to your requirement requirement. Method 1 – substr_replace function Use the substr_replace function to remove the last character from a string in PHP. Syntax: substr_replace($string ,””, -1); Example: $string = “Hello Webtechsource Admin!”; echo “String: ” . $string . “\n”; echo “Output string: ” . Read more…