Ngôn ngữ PHP - In ký tự tiếp theo của một ký tự cho trước

Viết một secript để in ký tự tiếp theo của một ký tự

Ví dụ:

PHP String Exercises: Print the next character of a specific character

Mã nguồn PHP:

<?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";
?>

hiepsiitphp

Lưu đồ thuật toán:

Flowchart: Print the next character of a specific character