programming-examples/php/String/PHP script to print the next character of a specific character..php

10 lines
226 B
PHP
Raw Permalink Normal View History

2019-11-15 12:59:38 +01:00
<?php
$cha = 'a';
$next_cha = ++$cha;
//The following if condition prevent you to go beyond 'z' or 'Z' and will reset to 'a' or 'A'.
if (strlen($next_cha) > 1)
{
$next_cha = $next_cha[0];
}
echo $next_cha."\n";
?>