title: PHP convert CSV to specific JSON format
body: <p>I have a CSV file that looks like:</p>
  
  <pre><code>Name, Id, Address, Place,
  John, 12, "12 mark street", "New York",
  Jane, 11, "11 bark street", "New York"...
  </code></pre>
  
  <p>I have about 500 coloumns. I would like to convert this to JSON, but I want the output to look like:</p>
  
  <pre><code>{
      "name": [
          "John",
          "Jane"
      ],
      "Id": [
          12,
          11
      ],
      "Address": [
          "12 mark street",
          "12 bark street"
      ],
      "Place": [
          "New York",
          "New York"
      ]
  }
  </code></pre>
  
  <p>Using PHP, how can I iterate through the CSV file so that I can make each column in the first row an array that holds the values in the same column on all the other rows?</p>