📜  如何在 foreach 循环之外获取变量 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:08.085000             🧑  作者: Mango

代码示例1
$date_array = array();
if( !empty($row_edit) ){
    $stageDates = explode(', ',$row_edit['placement_stage_date']);
    foreach( $stageDates as $stageDate ){
        //echo $stageDate.'
'; $date_array[] = $stageDate; } } // print $stageDate value outside of loop, something like this