From 73d49a766e4cc8eaabaaf17db65b10d55805f5b5 Mon Sep 17 00:00:00 2001 From: hu-congming <2491249199@qq.com> Date: Tue, 17 May 2022 13:27:14 +0800 Subject: [PATCH] x --- .../20220516_\344\275\234\344\270\232.md" | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 "\350\203\241\346\242\246\347\217\202/20220516_\344\275\234\344\270\232.md" diff --git "a/\350\203\241\346\242\246\347\217\202/20220516_\344\275\234\344\270\232.md" "b/\350\203\241\346\242\246\347\217\202/20220516_\344\275\234\344\270\232.md" new file mode 100644 index 0000000..66b4ba7 --- /dev/null +++ "b/\350\203\241\346\242\246\347\217\202/20220516_\344\275\234\344\270\232.md" @@ -0,0 +1,39 @@ +```php +"; +////2, +echo trim($abc); +echo "
"; +//3, +echo substr($arr,3,6); +echo"
"; + +//3、 写一段程序,创建一个数组,其元素内容为从1到20的所有整数,并输出该数组。 + +$arr = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); +foreach ($arr as $a){ + echo $a." "; +} + +//4、 写一段代码,查找数组中是否存在某一个指定的元素,如果存在则返回数组的索引。 +$arr = array(1,2,3,4,5,6,7,8,9,10); + echo array_search(4,$arr); + +//5、 写一段程序,创建一个关联数组,其元素是姓名,年龄,性别等个人信息,并输出该数组。 +$arr = array('name'=>'徐诗恒','age'=>'19','sex'=>'男'); +foreach ($arr as $key =>$b){ + echo $key."=".$b."
"; +} +``` \ No newline at end of file -- Gitee