PHP数组 foreach妙用

PHP数组 foreach妙用


<?php
//快速创建数组$a
$a=range('H','N');


//此处请使用for循环依次显示数组$a元素的大写
for($i=0;$i<count($a);$i++){
    echo $a[$i].'<br>';
}

//此处请使用foreach循环依次显示数组$a元素的小写

foreach($a as $value){
    echo strtolower($value) .'<br>';
}
?>

修改时间

2018/06/29 22:51

Team Members:
friend

Comments (258)

Generic placeholder image
Jeremy Tomlinson
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
Generic placeholder image
Kathleen Thomas
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
Progress
Settings

Basic Settings


Recent Activity

You sold an item Paul Burgess just purchased “Hyper - Admin Dashboard”!

5 minutes ago

Product on the Bootstrap Market Dave Gamache added Admin Dashboard

30 minutes ago

Robert Delaney Send you message "Are you there?"

2 hours ago

Audrey Tobey Uploaded a photo "Error.jpg"

14 hours ago

You sold an item Paul Burgess just purchased “Hyper - Admin Dashboard”!

1 day ago