我想做的是:
$array_data = array( "a" => array(1, 2, 3), "b" => array( 1, 2, 3 ) );
$table_converted = CONVERT_TO_MYSQL_TABLE( $array_data );
while ($row = mysql_fetch_assoc( $table_converted )) {
echo $row['a'] . " union " . $row['b'];
}
答案 0 :(得分:0)
循环遍历数组,并使用相同的键构造一个数组,但顺序不同:
$array_data = array( "a" => array(1, 2, 3), "b" => array( 1, 2, 3 ) );
$results = array();
foreach ($array_data as $name => $values)
{
foreach ($values as $i => $value)
{
$results[$i][$name] = $value;
}
}
print_r($results);