Change value in array key that has a specific sub key value in php

Viewed 452

What is the shortest way to change multiple values in array key that has a specific value in it?

For example, I have this array:

array(2) {
  [0]=>
  array(5) {
    ["state"]=>
    string(6) "active"
    ["payer_mail"]=>
    string(12) "mail@none.com"
    ["start"]=>
    string(12) "06/05/2015"
    ["end"]=>
    string(8) "08/07/2017"
    ["price"]=>
    string(8) "45.00"
    ["keystring"]=>
    string(8) "493457025"
  }
  [1]=>
  array(6) {
    ["place"]=>
    string(2) "47"
    ["state"]=>
    string(8) "canceled"
    ["payer_mail"]=>
    string(12) "mail@none.com"
    ["start"]=>
    string(9) "20/8/2014"
    ["end"]=>
    string(10) "20/10/2017"
    ["price"]=>
    string(5) "95.00"
    ["keystring"]=>
    string(8) "34879205"
  }
}

And I want to change the "state" value of the key that has "34879205" value for his "keystring" sub-key.

3 Answers
Related