I have an array with the following structure :
$array = array(
array("animal" => "dog","color" => "black"),
array("animal" => "cat","color" => "white"),
array("animal" => "mouse","color" => "grey")
);
Now I need to execute a function on every value of animal, say make the values uppercase. This is the expected output :
array(3) {
[0]=>
array(2) {
["animal"]=>
string(3) "DOG"
["color"]=>
string(5) "black"
}
[1]=>
array(2) {
["animal"]=>
string(3) "CAT"
["color"]=>
string(5) "white"
}
[2]=>
array(2) {
["animal"]=>
string(5) "MOUSE"
["color"]=>
string(4) "grey"
}
}
When I do
for (int i=0; i<=$array.size(); i++) {
$array["animal"] = array_map('strtoupper', $array["animal"]);
}
I get this error:
<b>Parse error</b>: syntax error, unexpected 'i' (T_STRING), expecting ';' in <b>[...][...]</b> on line <b>15</b><br />

size, it usescount($array)