From ccdcda82607cbe03f37d3e7e08841352dcb43598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=90=BC?= <2910196733@qq.com> Date: Mon, 16 May 2022 15:23:49 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20220516-\344\275\234\344\270\232.txt" | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 "\346\226\271\347\220\274/20220516-\344\275\234\344\270\232.txt" diff --git "a/\346\226\271\347\220\274/20220516-\344\275\234\344\270\232.txt" "b/\346\226\271\347\220\274/20220516-\344\275\234\344\270\232.txt" new file mode 100644 index 0000000..27a5b20 --- /dev/null +++ "b/\346\226\271\347\220\274/20220516-\344\275\234\344\270\232.txt" @@ -0,0 +1,37 @@ +"; +////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 $aaa){ + echo $aaa." "; +} + +//4、 写一段代码,查找数组中是否存在某一个指定的元素,如果存在则返回数组的索引。 +$arr = array(1,2,3,4,5,6,7,8,9,10); + echo array_search(5,$arr); + +//5、 写一段程序,创建一个关联数组,其元素是姓名,年龄,性别等个人信息,并输出该数组。 +$arr = array('name'=>'方琼','age'=>'19','sex'=>'女'); +foreach ($arr as $key =>$b){ + echo $key."=".$b."
"; +} \ No newline at end of file -- Gitee