Home > Backend Development > PHP Tutorial > js数组跟php数组的区别

js数组跟php数组的区别

WBOY
Release: 2016-06-13 12:16:59
Original
1444 people have browsed it

js数组和php数组的区别
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();<br />$c   = 10;<br />$f   = 5;<br />$d   = 7;<br /><br />for( $i = 1; $i <= ($c + $f) ; $i++){<br />    $arr[ $i ] = '';<br />}<br /><br />for( $i = 1; $i <= ($c + $f) ; $i++){<br />    if( $i <= $d ){<br />        $arr[$i] .= "第{$i}天";<br />    }else{<br />        $arr[$i] .= "*第{$i}天";<br />    }<br />}<br /><br />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