$a = [ '0' => [ 'a' => '11', 'b' => '22', 'c' => '33' ], '1' => [ 'a' => '44', 'b' => '55', 'c' => '66' ], ... ];
ringa_lee
No, and it makes no sense. No matter what, you have to loop in disguise to achieve traversal.
$a=array_map($a,function($val){ $val['b']=99; return $val; })
For another method, even if you don’t need a loop, then that method must also use a loop
SoChange the soup but not the medicine
The order upstairs is messed up. It should be array_map(function,$arr);In fact, what you said upstairs is correct. Built-in functions need to traverse the entire array. How should you use built-in functions to solve your problem?
$a=array_map(function($val){ $val['b']='99'; return $val; },$a);
Boring, not grasping the big picture, getting hung up on minutiae. So I’m bored too, haha
$arr = [ '0' => [ 'a' => '11', 'b' => '22', 'c' => '33' ], '1' => [ 'a' => '44', 'b' => '55', 'c' => '66' ] ]; $arr = json_encode($arr); $match = preg_replace('/"b":"(.+?)"/', '"b":"99"', $arr); var_dump(json_decode($match, true));
Convert to string + regular match and replace?
No, and it makes no sense.
No matter what, you have to loop in disguise to achieve traversal.
For another method, even if you don’t need a loop, then that method must also use a loop
SoChange the soup but not the medicine
The order upstairs is messed up. It should be array_map(function,$arr);
In fact, what you said upstairs is correct. Built-in functions need to traverse the entire array. How should you use built-in functions to solve your problem?
Boring, not grasping the big picture, getting hung up on minutiae. So I’m bored too, haha
Convert to string + regular match and replace?