At first I planned to use foreach to traverse it, but found that it was not successful, oo failed, and there was no way to write oo...
After research, I decided to use a for loop. The demonstration code is as follows:
Copy code The code is as follows:
$blog=array(
array(
"titledata"=>" titleMM",
"bodydata"=>"bodyMM"
),
array(
"titledata"=>"titleGG",
"bodydata"=>"bodyGG"
)
);
//Error
foreach($blog as $b)
{
$b['titledata']="BB";
$b ['bodydata']="CC";
}
print_r($blog);
//Correct
for($i=0;$i{
$blog[$i]['titledata']="title";
$blog[$i]['bodydata']="body";
}
?>
http://www.bkjia.com/PHPjc/323278.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323278.htmlTechArticleAt first I planned to use foreach to traverse it, but found that it was not successful, oo failed, and there was no way to write... ··· After research, I decided to use a for loop. The demo code is as follows: Copy the code as follows...