js数组和php数组的区别

WBOY
Release: 2016-06-23 13:37:50
Original
1087 people have browsed it

var arr=new Array(c+1+f);  
for(var i=1;i  {   Array[i]="";  } 
 for(var i=1;i  {   if(i {    Array[i]+="第"+i+"天";   }  
 else  
 {    Array[i]+=“*”+"第"+i+"天";   }
 }
这段js这么改写成php?
新手,数组看了概念还是不通


回复讨论(解决方案)

$arr = array();$c   = 10;$f   = 5;$d   = 7;for( $i = 1; $i <= ($c + $f) ; $i++){    $arr[ $i ] = '';}for( $i = 1; $i <= ($c + $f) ; $i++){    if( $i <= $d ){        $arr[$i] .= "第{$i}天";    }else{        $arr[$i] .= "*第{$i}天";    }}print_r($arr);
Copy after login

php的数组不是数组

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!