1phpCopy<?php
2$mystring = "This is a PHP program.";
3echo substr($mystring, 0, -1);
4?>
5
1phpCopy<?php
2$mystring = "This is a PHP program.";
3echo("This is the string before removal: $mystring\n");
4$newstring = rtrim($mystring, ". ");
5echo("This is the string after removal: $newstring");
6?>
7