<?php function get_next_colid(string $id): string { $length = \strlen($id); for ($i = $length - 1; $i >= 0; $i--) { if ($id[$i] === "\xff") { $id[$i] = "\0"; continue; } $id[$i] = \chr(\ord($id[$i]) + 1); return $id; } return str_repeat("\0", $length + 1); } var_dump( get_next_colid(''), get_next_colid('hello'), get_next_colid('world'), get_next_colid('a'), get_next_colid('c'), get_next_colid('👍'), );
You have javascript disabled. You will not be able to edit any code.