title: Create a PHP array with the same key for multiple rows to json_encode
body: <p>In wordpress, I call a WP_Query. For each post found, I add a key+value row to a PHP array.</p>
  
  <pre><code>$array[$key] = $value;
  </code></pre>
  
  <p>The key is a timestamp, the value a string. Here comes the problem. In order to use a jQuery calendar, I need to get a JSON object as follows :</p>
  
  <pre><code>var codropsEvents = {
  '11-23-2015' : 'text',
  '11-23-2015' : 'text two',
  '11-20-2015' : 'some other text',
  '11-19-2015' : 'Anything that is text'
  };
  </code></pre>
  
  <p>To do this, the json_encode() function almost works.</p>
  
  <p>The thing is, PHP doesn't allow to use the same key in multiple rows : if I have multiple posts with the same timestamp (a wp meta value), PHP only stores one in the array.</p>
  
  <p>My calendar therefore displays only one post per day.</p>
  
  <p><strong>How can I organize my PHP array in order to get the good format of the JSON object?</strong></p>
  
  <p>** /!\ UPDATE /!\ **</p>
  
  <p>In fact, I don't need multiple rows with the same key. For every post with the same timestamp, I need to create a row with a unique key (the timestamp) and a unique value which will be a string containing all the posts titles.</p>
  
  <p>Hope I'm clear.</p>