How to increment a letter by N in PHP

1 Answer

0 votes
function increaseby($ch, $n) {
	$i = 0;
	while ($i < $n) {
		$ch++;
		$i++;
	}
	return $ch;
}

$ch = 'a';

$ch = increaseby($ch, 5);

echo $ch;



/*
run:
 
f
 
*/

 



answered Aug 22, 2020 by avibootz

Related questions

2 answers 287 views
287 views asked Aug 22, 2020 by avibootz
2 answers 262 views
1 answer 221 views
221 views asked Apr 23, 2021 by avibootz
4 answers 348 views
...