时间:2021-07-01 10:21:17 帮助过:29人阅读
'good', 'swimming' => 'very well', 'running' => 'not good'); foreach ($sports as $key => $value) { echo $key.": ".$value."
";
} ?>
方法2,each
'good', 'swimming' => 'very well', 'running' => 'not good'); while ($elem = each($sports)) { echo $elem['key'].": ".$elem['value']."
";
} ?>
方法3:list & each
'good', 'swimming' => 'very well', 'running' => 'not good'); while (list($key, $value) = each($sports)) { echo $key.": ".$value."
"; ?>
以上就介绍了PHP 数组遍历方法总结,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。