摘要: <?php //https://www.cainiaojc.com/php/php-regular-expressions.html 中文版正则表达式说明 $mail1 = "ayang.li@qq.com"; $partten = "/^\S+\.\S+\@\S+\.\S+/"; if (preg 阅读全文
posted @ 2025-04-27 16:29 黑山老猫 阅读(3) 评论(0) 推荐(0)
摘要: <?php namespace Fatherspace { const FLAG = 123; class Person { protected $weight = 60; public function say() { echo "person hello" . PHP_EOL; } } inte 阅读全文
posted @ 2025-04-27 15:27 黑山老猫 阅读(7) 评论(0) 推荐(0)
摘要: <?php declare(strict_types=1); function add(int $a, int $b): int { //限制参数类型和返回值类型 return $a + $b; } echo add(1, 2) . PHP_EOL; function hello(string $n 阅读全文
posted @ 2025-04-27 14:58 黑山老猫 阅读(4) 评论(0) 推荐(0)
摘要: <?php $array1 = array("a", "b", "c", "d"); for ($i = 0; $i < count($array1); $i++) { echo $array1[$i] . "\n"; } foreach ($array1 as $value) { echo $va 阅读全文
posted @ 2025-04-27 14:52 黑山老猫 阅读(3) 评论(0) 推荐(0)
摘要: <?php $txt1 = "Hello"; $txt2 = "World"; echo $txt1 . " " . $txt2 . PHP_EOL; //拼接 echo strlen($txt1) . PHP_EOL; //字符串长度 $name = "Leyland"; echo strpos( 阅读全文
posted @ 2025-04-27 13:56 黑山老猫 阅读(8) 评论(0) 推荐(0)