title: Can't change value in array php
body: <pre><code>{
      "available":18,
      "bind":0,
      "info":"",
      "hours_definitions":[
          {
              "value":"21:40"
          },
          {
              "value":"22:50"
          }
      ],
      "hours":{
          "21:40":{
              "available":1,
              "bind":0,
              "info":"",
              "notes":"",
              "price":3000,
              "promo":0,
              "status":"available"
          },
          "22:50":{
              "available":1,
              "bind":0,
              "info":"",
              "notes":"",
              "price":3000,
              "promo":0,
              "status":"available"
          }
      },
      "notes":"",
      "price":2000,
      "promo":0,
      "status":"available"
  }
  </code></pre>
  
  <p>I have JSON array (<strong>$dataar</strong>), where I need to change "available" to 0 where "hours" array 21:40.</p>
  
  <p>I am trying to use foreach:</p>
  
  <pre><code>$dataar1 = json_decode($dataar, true);
  $dataar2 = $dataar1['hours'];
  $hour = "21:40";
  foreach ($dataar2 as $key =&gt; $entry) {
       if ($key == $hour) {
          $dataar2[$key]['available'] = 0;
      }
  }
  </code></pre>
  
  <p>And I get <code>$dataar2[$key]['available'] = 0</code>, but when I am trying to <code>json_encode</code> it back, i see available:1 again.</p>
  
  <p>How can I fix it?</p>