How to Convert an Multidimensional Array to One Dimensional Array
//First Method with No Argument

$this->RestructArray($arrTempCounts)

//Second Method with  Column Name as Argument
$this->RestructArray($arrTemp, 'UserNums');

function RestructArray($parrInput, $pArg1 = 0)
{
	$arrTemp = $parrInput;
	
	for($i=0;$i<count($parrInput);$i++)
	{
		$arrNames[$i] = $parrInput[$i][$pArg1];
	}
	return $arrNames;
}

How to Convert an One Dimensional Array to Multidimensional Array

$k = 0;
for($j=0;$j<$lngCols;$j++)
{
	for($i=0;$i<$lngRows-1;$i++)
	{		
		$arrTemp[$j][$i] = $arrIndividualCounts[$k];
		$k = $k+1;
	}
}
Posted in PHP.

Leave a reply