i have an array like this
array(2) {
[0]=> object(stdClass)#20
(4) {
["id"]=> string(1) "1"
["name"]=> string(6) "robert"
["height"]=> string(3) "165"
["weight"]=> string(2) "81" }
[1]=> object(stdClass)#21
(4) {
["id"]=> string(1) "2"
["name"]=> string(4) "mike"
["height"]=> string(3) "175"
["weight"]=> string(2) "69" } }
so, I want to change my array values.
for example i want to change all value from ["height"] and ["weight"]. I categorize height and weight in the form of numbers like this:
height
1 = 150 .......... 170
2 = 171 .......... 190
weight
1 = 50 ........... 70
2 = 71 ........... 80
array(2) {
[0]=> object(stdClass)#20
(4) {
["id"]=> string(1) "1"
["name"]=> string(6) "robert"
["height"]=> string(1) "1"
["weight"]=> string(1) "2" }
[1]=> object(stdClass)#21
(4) {
["id"]=> string(1) "2"
["name"]=> string(4) "mike"
["height"]=> string(1) "2"
["weight"]=> string(1) "1" } }
my array is dynamic so that value can change anytime. of course ["name"] will not change at all because I did not give categorization. can you help me how to solve this problem?
dynamic? and is the array build from a database?