Forum Moderators: coopster
is there a php function that can do something like this?
I am not sure if there is one PHP function which can do that but you can try something like the following:
$num = "423467";
$last_num = substr($num,-1);
$line = rtrim($num, $last_num).".".$last_num;
if you wish you can put this in a function:
function add_period($num) {
$last_num = substr($num,-1);
$line = rtrim($num, $last_num).".".$last_num;
return $line;
}
to be used later in the following format:
echo add_period($input_num);
Habtom
[edited by: Habtom at 9:15 am (utc) on Oct. 31, 2007]