<?PHP//Job 1 output 20 consecutive oddfunctionOdd$length){ $arr=Array(); $a=-1; for($i= 0;$i<$length;$i++){ $a+ = 2; $arr[$i] =$a; } Echo"<pre>"; Print_r($arr); Echo"</pre>";} Odd (20);? ><?PHP//job two//construct a contiguous array of natural numbersfunctionNum$length){ $arr=Array(); $a= 0; for($i= 0;$i<$length;$i++){ $a+ = 1; $arr[$i] =$a; } return $arr;}//The first parameter is the length of the array, and the second argument is the length of the end of the intercept.functionOPRT ($a,$b){ $arr 1= num ($a); //The remainder of the intercept is the last five items of the array, that is, $ARR1 is the end five $b=Count($arr 1)-5;$arr 2=Array_splice($arr 1, 0,$b);//arr2:1, 2, 3, 4, 5 $res=Array_merge($arr 1,$arr 2);//Arr1:6, 7, 8, 9, ten Echo"<pre>"; Print_r($res); Echo"</pre>";} OPRT (20, 5);? ><?PHP//job three turn Close_door into ClosedoorfunctionChange$str){ $arr=Explode("_",$str); foreach($arr as $key=$value){ $tmp=Ucfirst($value); $tarr[] =$tmp; } $tarr=implode("",$tarr); Echo $tarr;} Change ("Close_door");?>
Output 20 consecutive odd, array splicing merge, String cut