Initial commit

This commit is contained in:
2025-01-07 17:55:50 +08:00
commit eab1d70061
86 changed files with 2772 additions and 0 deletions

29
20241208/program_85.php Normal file
View File

@ -0,0 +1,29 @@
<?php
// 自定义函数实现首尾字母交换
function mySwap($string) {
// 检查字符串是否为空或长度为1
if (strlen($string) <= 1) {
return $string;
}
// 获取首字母和尾字母
$firstChar = $string[0];
$lastChar = $string[strlen($string) - 1];
// 替换首尾字母
$swappedString = $lastChar . substr($string, 1, -1) . $firstChar;
return $swappedString;
}
// 获取URL传递的字符串
if (isset($_GET['string'])) {
$string = $_GET['string'];
// 输出结果
echo mySwap($string);
} else {
echo "请通过URL传递字符串例如program_85.php?string=example";
}
?>
<?php