{"id":12607,"date":"2022-09-11T11:46:50","date_gmt":"2022-09-11T15:46:50","guid":{"rendered":"http:\/\/local.brightwhiz\/?post_type=snippets&p=12607"},"modified":"2022-09-11T11:46:52","modified_gmt":"2022-09-11T15:46:52","slug":"php-replace-last-character-in-string","status":"publish","type":"snippets","link":"http:\/\/local.brightwhiz\/snippets\/php-replace-last-character-in-string\/","title":{"rendered":"PHP Replace Last Character in String"},"content":{"rendered":"\n
This PHP replace last character in string example using Remove last character from string if character is known using substr<\/code>:<\/p>\n\n\n\n
$string = substr($string, 0, -1);<\/code><\/pre>\n\n\n\n
rtrim<\/code>:<\/p>\n\n\n\n
$sourcestr = "Remove the comma from end of this string,";\n\n$string = rtrim($arraynama, ",");\n\n\/\/ Output\n\/\/ Remove the comma from end of this string<\/code><\/pre>\n","protected":false},"comment_status":"open","ping_status":"closed","template":"","meta":[],"categories":[953,23,27,15,16],"tags":[424,452,471,638],"yoast_head":"\n