Php 基于计数动态设置为
我在我的网站上有一个砌体部分,根据该部分中的项目数量,每个单独的部分将有不同的宽度。现在我正在手动设置每个项目的宽度。有更好的办法吗Php 基于计数动态设置为,php,arrays,dynamic,Php,Arrays,Dynamic,我在我的网站上有一个砌体部分,根据该部分中的项目数量,每个单独的部分将有不同的宽度。现在我正在手动设置每个项目的宽度。有更好的办法吗 if($postCount == 1){$width = array("1-1");} if($postCount == 2){$width = array("2-3","1-3");} if($postCount == 3){$width = array("1-3","1-3","1-3");} if($postCount == 4){$width = arra
if($postCount == 1){$width = array("1-1");}
if($postCount == 2){$width = array("2-3","1-3");}
if($postCount == 3){$width = array("1-3","1-3","1-3");}
if($postCount == 4){$width = array("2-3","1-3","2-3","1-3");}
if($postCount == 5){$width = array("2-3","1-3","1-3","1-3","1-3");}
if($postCount == 6){$width = array("1-3","1-3","1-3","1-3","1-3","1-
3");}
if($postCount == 7){$width = array("2-3","1-3","1-3","1-3","1-3","2-
3","1-3");}
if($postCount == 8){$width = array("2-3","1-3","1-3","1-3","1-3","1-3","1-3","1-3");}