我需要帮助将 php 数组转换为下面的红色。我已经能够将一些数组转换为字典,但不确定最好的解决方案是什么,因为这是一个数组内部的数组。
$reg_rows=array();
$rc_count=0;
$reg_counter=0;
$hold_achtrndt="1970-01-01";
$hold_regpay_sort="0";
while ( ($row_rc=sqlsrv_fetch_assoc($result_rc)) )
{
if ( strtoupper(substr($row_rc['tb_value1'],4,1))=="Y" )
$reg_counter=count($reg_rows); //If the paymethod is set to require it's own deposit, increment
elseif ( $row_rc['regpay_sort']!=$hold_regpay_sort )
{
$reg_counter=count($reg_rows); //If the paymethod changes, increment so each different type is separated
$hold_regpay_sort=$row_rc['regpay_sort'];
}
**$reg_rows[$reg_counter][$row_rc['rc_code']]=$row_rc;** //THIS IS THE ARRAY I NEED HELP WITH
$rc_count++;
}
如果我向您展示我想要得到的东西,也许会更容易。下面的示例。where 0and1将是 reg_counter 和5514, 5115,5116将是 the$row_rc['rc_code']和 thearray[78]是从 SQL 表返回的字段。
$reg_rows[0][5515]{array[78]}
$reg_rows[1][5514]{array[78]}
$reg_rows[1][5516]{array[78]}
慕哥9229398
慕的地8271018
随时随地看视频慕课网APP
相关分类