我有PHP代碼:PHP的foreach回聲X元素和計數的許多元素如何離開
if($stmt->rowCount() > 0) :
$otherProfiles = array();
foreach($playerOtherProfiles as $otherProfile) :
$otherProfiles[] = "<li>$otherProfile[Name]</li>";
endforeach;
//echo implode(", ", $otherProfiles)..
這將打印all otherProfiles
。是否可以只打印,然後打印多少個左側面?
例如,如果配置文件是4 - 印刷3和回聲1分左,
如果5 - 打印3,回聲2左側..由於預先
非常感謝你! – EvaldasL