我想初始化一個變量,并希望稍后在我的foreach循環中使用它,以下是我的工作:$lastdepdate = "";$resultDEP = "SELECT * FROM mytable";foreach($resultDEP as $rows){ $lastdepdate = trim($row['LastDepDate']);}我從我的表格中獲取日期,并將其與今天的日期一起檢查,并且if ($AssetClassID > 01) { $returnDep = $depSL;} else if($AssetClassID > 02){ $returnDep = $Cost;}$DepAmount = $returnDep;如何在 if 和 else if 循環中實現此目的?
如何初始化一個變量以便稍后在php中使用它?
慕田峪4524236
2022-09-03 15:52:56