title: Extract Json data from a countries.csv file on github, and create a seperate array of timezones
body: <p><a href="https://github.com/dr5hn/countries-states-cities-database/blob/master/csv/countries.csv" rel="nofollow noreferrer">Country.csv</a></p>
  <p>this is <code>countries.csv</code> file, and i want to extract all the timezones from it, which is its 14th colomn, and the data in there is not properly <code>json formatted</code>. I'm trying to parse the json but it failed. Actually, I want to create an <code>array</code> of timezones  like this</p>
  <pre class="lang-php prettyprint-override"><code>    [0] =&gt; {zoneName:'Asia -&gt; Kabul',gmtOffset:16200,gmtOffsetName:'UTC+04:30',abbreviation:'AFT',tzName:'Afghanistan Time'}
      [1] =&gt; {zoneName:'Europe -&gt; Mariehamn',gmtOffset:7200,gmtOffsetName:'UTC+02:00',abbreviation:'EET',tzName:'Eastern European Time'}
      [2] =&gt; {zoneName:'Europe -&gt; Tirane',gmtOffset:3600,gmtOffsetName:'UTC+01:00',abbreviation:'CET',tzName:'Central European Time'}
      [3] =&gt; {zoneName:'Africa -&gt; Algiers',gmtOffset:3600,gmtOffsetName:'UTC+01:00',abbreviation:'CET',tzName:'Central European Time'}
      [4] =&gt; {zoneName:'Pacific -&gt; Pago_Pago',gmtOffset:-39600,gmtOffsetName:'UTC-11:00',abbreviation:'SST',tzName:'Samoa Standard Time'}
      [5] =&gt; {zoneName:'Europe -&gt; Andorra',gmtOffset:3600,gmtOffsetName:'UTC+01:00',abbreviation:'CET',tzName:'Central European Time'}
      [6] =&gt; {zoneName:'Africa -&gt; Luanda',gmtOffset:3600,gmtOffsetName:'UTC+01:00',abbreviation:'WAT',tzName:'West Africa Time'}
  </code></pre>
  <p>what i'm doing, is this in <code>App\Http\Controllers\TestController::class</code> is this</p>
  <pre class="lang-php prettyprint-override"><code>    public function timezone(): void {
          $data = [];
  
          if (($open = fopen(__DIR__ . '/countries.csv', 'r + b')) !== FALSE) {
              while (($singleRecord = fgetcsv($open, NULL, ',')) !== FALSE) {
                  $data[] = $singleRecord;
              }
              fclose($open);
          }
  
          $data = $this-&gt;removeCharacters($data, ['[', ']']);
          $data = $this-&gt;removeCharacters($data, (array)'\/', &quot; -&gt; &quot;);
  
          // $data = $this-&gt;removeCharacters($data, (array)'{}', '');
          // dd(explode('},', $data[33][14]));
          // dd(explode('},', $this-&gt;longJson));
          // dd(explode(',', str_replace(['{', '}'], '', $data[167][14])));
  
          $singleArray = [];
          $count = count($data);
          $itemsArray = [];
  
          for ($i = 1; $i &lt; $count; $i++) {
  
              $singleArray[] = explode('},', $data[$i][14]);
  
              foreach ($singleArray as $item) {
  
                  foreach ($item as $singleItem) {
  
                      $itemsArray[] = $singleItem;
  
                  }
              }
          }
          $itemsArray = array_unique($itemsArray);
  
          $this-&gt;printFormattedData($itemsArray);
      }
   private function removeCharacters($hayStack, array $charsArray, $character = ''): array {
          $tempArray = [];
          foreach ($hayStack as $item) {
              $tempArray[] = str_replace($charsArray, $character, $item);
          }
          return $tempArray;
      }
  
      private function printFormattedData($data): void {
          echo '&lt;pre&gt;';
          print_r($data);
          echo '&lt;/pre&gt;';
      }
  
  
  </code></pre>