PHP - select data from csv and make associative array











up vote
1
down vote

favorite












I've got a .csv file with ZIP codes containing the city and its sub-districts




67401,City 1,district_a
67401,City 2,district_b
67401,City 3,district_c
67401,City 3,district_d
67401,City 3,district_e
67401,City 3,district_f
67401,City 3,district_g
67401,City 3,district_h
67401,City 3,district_i
67401,City 3,district_j
67401,City 3,district_k
67401,City 3,district_l
67401,City 3,district_m
67401,City 3,district_n
67401,City 3,district_o
67401,City 3,district_p
67401,City 3,district_q
67401,City 3,district_r
67401,City 3,district_s
67401,City 4,district_t
67401,City 5,district_u

67501,City 6,district_v
67501,City 7,district_w
67501,City 8,district_x
67501,City 8,district_y
67501,City 8,district_z


And I need to put it in an array, where I can select/serach by the zipcode (67401, 67501, etc.) and return these results as an associative array in this format, so I can populate a select control.



For example I want to look-up all the Cities and its distrcits with zipcode 67401 I need this result:



"City 1" => [
district_a => district_a
],
"City 2" => [
district_b => district_b
],
"City 3" => [
district_c => district_c
district_d => district_d
district_e => district_e
district_f => district_f
district_g => district_g
district_h => district_h
district_i => district_i
district_j => district_j
district_k => district_k
district_l => district_l
district_m => district_m
district_n => district_n
district_o => district_o
district_p => district_p
district_q => district_q
district_r => district_r
district_s => district_s
],
"City 4" => [
district_t => district_t
],
"City 5" = [
district_u => district_u
]


Right now I've got this working code, but I'm sure there has to be a more simple way how to achieve it.



<?php 
$zipcode = '67401';

$a = file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$a = array_map(function ($i) {return explode(',', $i); }, $a);
$a = array_filter($a, function ($i) use ($zipcode) { return $i[0] == $zipcode; });

$b = ;
$i = 0;
foreach ($a as $key => $value) {
$b[$i++] = [
'city' => $value[1],
'district' => $value[2],
];
}

$c = ;

foreach($b as $key => $item) {
$c[$item['city']][$key] = $item;
}

ksort($c, SORT_REGULAR);

$d = ;
foreach($c as $key => $value) {
$subarray = ;
foreach($value as $s_key => $s_val) {
foreach($s_val as $ss_key => $ss_val) {
$subarray[$ss_val] = $ss_val;
}
}
$d[$key] = $subarray;
}

$myresult = $d;
?>









share|improve this question


















  • 1




    Any chance to store this data in a database?
    – Your Common Sense
    51 mins ago










  • Yes, that would be possible. But still I would get the same results from database as are stored in variable $a, right?
    – Café
    47 mins ago






  • 1




    You would never get the same results from a database as it can filter out and sort the data for you. And a database API can format the resulting array
    – Your Common Sense
    14 mins ago















up vote
1
down vote

favorite












I've got a .csv file with ZIP codes containing the city and its sub-districts




67401,City 1,district_a
67401,City 2,district_b
67401,City 3,district_c
67401,City 3,district_d
67401,City 3,district_e
67401,City 3,district_f
67401,City 3,district_g
67401,City 3,district_h
67401,City 3,district_i
67401,City 3,district_j
67401,City 3,district_k
67401,City 3,district_l
67401,City 3,district_m
67401,City 3,district_n
67401,City 3,district_o
67401,City 3,district_p
67401,City 3,district_q
67401,City 3,district_r
67401,City 3,district_s
67401,City 4,district_t
67401,City 5,district_u

67501,City 6,district_v
67501,City 7,district_w
67501,City 8,district_x
67501,City 8,district_y
67501,City 8,district_z


And I need to put it in an array, where I can select/serach by the zipcode (67401, 67501, etc.) and return these results as an associative array in this format, so I can populate a select control.



For example I want to look-up all the Cities and its distrcits with zipcode 67401 I need this result:



"City 1" => [
district_a => district_a
],
"City 2" => [
district_b => district_b
],
"City 3" => [
district_c => district_c
district_d => district_d
district_e => district_e
district_f => district_f
district_g => district_g
district_h => district_h
district_i => district_i
district_j => district_j
district_k => district_k
district_l => district_l
district_m => district_m
district_n => district_n
district_o => district_o
district_p => district_p
district_q => district_q
district_r => district_r
district_s => district_s
],
"City 4" => [
district_t => district_t
],
"City 5" = [
district_u => district_u
]


Right now I've got this working code, but I'm sure there has to be a more simple way how to achieve it.



<?php 
$zipcode = '67401';

$a = file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$a = array_map(function ($i) {return explode(',', $i); }, $a);
$a = array_filter($a, function ($i) use ($zipcode) { return $i[0] == $zipcode; });

$b = ;
$i = 0;
foreach ($a as $key => $value) {
$b[$i++] = [
'city' => $value[1],
'district' => $value[2],
];
}

$c = ;

foreach($b as $key => $item) {
$c[$item['city']][$key] = $item;
}

ksort($c, SORT_REGULAR);

$d = ;
foreach($c as $key => $value) {
$subarray = ;
foreach($value as $s_key => $s_val) {
foreach($s_val as $ss_key => $ss_val) {
$subarray[$ss_val] = $ss_val;
}
}
$d[$key] = $subarray;
}

$myresult = $d;
?>









share|improve this question


















  • 1




    Any chance to store this data in a database?
    – Your Common Sense
    51 mins ago










  • Yes, that would be possible. But still I would get the same results from database as are stored in variable $a, right?
    – Café
    47 mins ago






  • 1




    You would never get the same results from a database as it can filter out and sort the data for you. And a database API can format the resulting array
    – Your Common Sense
    14 mins ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I've got a .csv file with ZIP codes containing the city and its sub-districts




67401,City 1,district_a
67401,City 2,district_b
67401,City 3,district_c
67401,City 3,district_d
67401,City 3,district_e
67401,City 3,district_f
67401,City 3,district_g
67401,City 3,district_h
67401,City 3,district_i
67401,City 3,district_j
67401,City 3,district_k
67401,City 3,district_l
67401,City 3,district_m
67401,City 3,district_n
67401,City 3,district_o
67401,City 3,district_p
67401,City 3,district_q
67401,City 3,district_r
67401,City 3,district_s
67401,City 4,district_t
67401,City 5,district_u

67501,City 6,district_v
67501,City 7,district_w
67501,City 8,district_x
67501,City 8,district_y
67501,City 8,district_z


And I need to put it in an array, where I can select/serach by the zipcode (67401, 67501, etc.) and return these results as an associative array in this format, so I can populate a select control.



For example I want to look-up all the Cities and its distrcits with zipcode 67401 I need this result:



"City 1" => [
district_a => district_a
],
"City 2" => [
district_b => district_b
],
"City 3" => [
district_c => district_c
district_d => district_d
district_e => district_e
district_f => district_f
district_g => district_g
district_h => district_h
district_i => district_i
district_j => district_j
district_k => district_k
district_l => district_l
district_m => district_m
district_n => district_n
district_o => district_o
district_p => district_p
district_q => district_q
district_r => district_r
district_s => district_s
],
"City 4" => [
district_t => district_t
],
"City 5" = [
district_u => district_u
]


Right now I've got this working code, but I'm sure there has to be a more simple way how to achieve it.



<?php 
$zipcode = '67401';

$a = file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$a = array_map(function ($i) {return explode(',', $i); }, $a);
$a = array_filter($a, function ($i) use ($zipcode) { return $i[0] == $zipcode; });

$b = ;
$i = 0;
foreach ($a as $key => $value) {
$b[$i++] = [
'city' => $value[1],
'district' => $value[2],
];
}

$c = ;

foreach($b as $key => $item) {
$c[$item['city']][$key] = $item;
}

ksort($c, SORT_REGULAR);

$d = ;
foreach($c as $key => $value) {
$subarray = ;
foreach($value as $s_key => $s_val) {
foreach($s_val as $ss_key => $ss_val) {
$subarray[$ss_val] = $ss_val;
}
}
$d[$key] = $subarray;
}

$myresult = $d;
?>









share|improve this question













I've got a .csv file with ZIP codes containing the city and its sub-districts




67401,City 1,district_a
67401,City 2,district_b
67401,City 3,district_c
67401,City 3,district_d
67401,City 3,district_e
67401,City 3,district_f
67401,City 3,district_g
67401,City 3,district_h
67401,City 3,district_i
67401,City 3,district_j
67401,City 3,district_k
67401,City 3,district_l
67401,City 3,district_m
67401,City 3,district_n
67401,City 3,district_o
67401,City 3,district_p
67401,City 3,district_q
67401,City 3,district_r
67401,City 3,district_s
67401,City 4,district_t
67401,City 5,district_u

67501,City 6,district_v
67501,City 7,district_w
67501,City 8,district_x
67501,City 8,district_y
67501,City 8,district_z


And I need to put it in an array, where I can select/serach by the zipcode (67401, 67501, etc.) and return these results as an associative array in this format, so I can populate a select control.



For example I want to look-up all the Cities and its distrcits with zipcode 67401 I need this result:



"City 1" => [
district_a => district_a
],
"City 2" => [
district_b => district_b
],
"City 3" => [
district_c => district_c
district_d => district_d
district_e => district_e
district_f => district_f
district_g => district_g
district_h => district_h
district_i => district_i
district_j => district_j
district_k => district_k
district_l => district_l
district_m => district_m
district_n => district_n
district_o => district_o
district_p => district_p
district_q => district_q
district_r => district_r
district_s => district_s
],
"City 4" => [
district_t => district_t
],
"City 5" = [
district_u => district_u
]


Right now I've got this working code, but I'm sure there has to be a more simple way how to achieve it.



<?php 
$zipcode = '67401';

$a = file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$a = array_map(function ($i) {return explode(',', $i); }, $a);
$a = array_filter($a, function ($i) use ($zipcode) { return $i[0] == $zipcode; });

$b = ;
$i = 0;
foreach ($a as $key => $value) {
$b[$i++] = [
'city' => $value[1],
'district' => $value[2],
];
}

$c = ;

foreach($b as $key => $item) {
$c[$item['city']][$key] = $item;
}

ksort($c, SORT_REGULAR);

$d = ;
foreach($c as $key => $value) {
$subarray = ;
foreach($value as $s_key => $s_val) {
foreach($s_val as $ss_key => $ss_val) {
$subarray[$ss_val] = $ss_val;
}
}
$d[$key] = $subarray;
}

$myresult = $d;
?>






php array csv






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 52 mins ago









Café

162




162








  • 1




    Any chance to store this data in a database?
    – Your Common Sense
    51 mins ago










  • Yes, that would be possible. But still I would get the same results from database as are stored in variable $a, right?
    – Café
    47 mins ago






  • 1




    You would never get the same results from a database as it can filter out and sort the data for you. And a database API can format the resulting array
    – Your Common Sense
    14 mins ago














  • 1




    Any chance to store this data in a database?
    – Your Common Sense
    51 mins ago










  • Yes, that would be possible. But still I would get the same results from database as are stored in variable $a, right?
    – Café
    47 mins ago






  • 1




    You would never get the same results from a database as it can filter out and sort the data for you. And a database API can format the resulting array
    – Your Common Sense
    14 mins ago








1




1




Any chance to store this data in a database?
– Your Common Sense
51 mins ago




Any chance to store this data in a database?
– Your Common Sense
51 mins ago












Yes, that would be possible. But still I would get the same results from database as are stored in variable $a, right?
– Café
47 mins ago




Yes, that would be possible. But still I would get the same results from database as are stored in variable $a, right?
– Café
47 mins ago




1




1




You would never get the same results from a database as it can filter out and sort the data for you. And a database API can format the resulting array
– Your Common Sense
14 mins ago




You would never get the same results from a database as it can filter out and sort the data for you. And a database API can format the resulting array
– Your Common Sense
14 mins ago










2 Answers
2






active

oldest

votes

















up vote
1
down vote













Well, first of all this data must be stored in a database, not a file. Using PDO you'll get your array in a few lines (assuming a database connection is already established):



$sql = "SELECT city, district FROM zip WHERE zipcode=? ORDER BY city, district";
$stmt = $pdo->prepare($sql);
$stmt->execute([$zipcode]);
$data = $stmt->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_COLUMN);


As of the code present, there are way too much loops to my taste. I believe everything could be done in one loop, like



$data = ;
foreach (file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $row) {
list($zip, $city, $district) = explode(",",$row);
if (!isset($data[$zip])) {
$data[$zip] = ;
}
if (!isset($data[$zip][$city])) {
$data[$zip][$city] = ;
}
$data[$zip][$city] = $district;
}


well if you need to sort your arrays, a couple extra loops are still needed



foreach ($data as $zip => $city) {
ksort($data[$zip]);
foreach ($data[$zip] as $city) {
sort($data[$zip][$city]);
}
}





share|improve this answer




























    up vote
    0
    down vote













    Some extra inspirational stuff ;)



    // Load your CSV into array
    $zipcode = '67401';
    $options = ;
    $fh = fopen('zip.csv', 'r');
    while (($data = fgetcsv($fh)) !== false) {
    if ($zipcode == $data[0]) {
    list($zip, $city, $district) = $data;
    $options[$city][$district] = $district;
    }
    }
    fclose($fh);

    // Sort cities
    ksort($options);

    // Sort districts
    array_walk($options, function(&$districts) {
    ksort($districts);
    });

    // Enjoy!
    print_r($options);




    share








    New contributor




    Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.


















      Your Answer





      StackExchange.ifUsing("editor", function () {
      return StackExchange.using("mathjaxEditing", function () {
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
      });
      });
      }, "mathjax-editing");

      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "196"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f209825%2fphp-select-data-from-csv-and-make-associative-array%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote













      Well, first of all this data must be stored in a database, not a file. Using PDO you'll get your array in a few lines (assuming a database connection is already established):



      $sql = "SELECT city, district FROM zip WHERE zipcode=? ORDER BY city, district";
      $stmt = $pdo->prepare($sql);
      $stmt->execute([$zipcode]);
      $data = $stmt->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_COLUMN);


      As of the code present, there are way too much loops to my taste. I believe everything could be done in one loop, like



      $data = ;
      foreach (file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $row) {
      list($zip, $city, $district) = explode(",",$row);
      if (!isset($data[$zip])) {
      $data[$zip] = ;
      }
      if (!isset($data[$zip][$city])) {
      $data[$zip][$city] = ;
      }
      $data[$zip][$city] = $district;
      }


      well if you need to sort your arrays, a couple extra loops are still needed



      foreach ($data as $zip => $city) {
      ksort($data[$zip]);
      foreach ($data[$zip] as $city) {
      sort($data[$zip][$city]);
      }
      }





      share|improve this answer

























        up vote
        1
        down vote













        Well, first of all this data must be stored in a database, not a file. Using PDO you'll get your array in a few lines (assuming a database connection is already established):



        $sql = "SELECT city, district FROM zip WHERE zipcode=? ORDER BY city, district";
        $stmt = $pdo->prepare($sql);
        $stmt->execute([$zipcode]);
        $data = $stmt->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_COLUMN);


        As of the code present, there are way too much loops to my taste. I believe everything could be done in one loop, like



        $data = ;
        foreach (file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $row) {
        list($zip, $city, $district) = explode(",",$row);
        if (!isset($data[$zip])) {
        $data[$zip] = ;
        }
        if (!isset($data[$zip][$city])) {
        $data[$zip][$city] = ;
        }
        $data[$zip][$city] = $district;
        }


        well if you need to sort your arrays, a couple extra loops are still needed



        foreach ($data as $zip => $city) {
        ksort($data[$zip]);
        foreach ($data[$zip] as $city) {
        sort($data[$zip][$city]);
        }
        }





        share|improve this answer























          up vote
          1
          down vote










          up vote
          1
          down vote









          Well, first of all this data must be stored in a database, not a file. Using PDO you'll get your array in a few lines (assuming a database connection is already established):



          $sql = "SELECT city, district FROM zip WHERE zipcode=? ORDER BY city, district";
          $stmt = $pdo->prepare($sql);
          $stmt->execute([$zipcode]);
          $data = $stmt->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_COLUMN);


          As of the code present, there are way too much loops to my taste. I believe everything could be done in one loop, like



          $data = ;
          foreach (file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $row) {
          list($zip, $city, $district) = explode(",",$row);
          if (!isset($data[$zip])) {
          $data[$zip] = ;
          }
          if (!isset($data[$zip][$city])) {
          $data[$zip][$city] = ;
          }
          $data[$zip][$city] = $district;
          }


          well if you need to sort your arrays, a couple extra loops are still needed



          foreach ($data as $zip => $city) {
          ksort($data[$zip]);
          foreach ($data[$zip] as $city) {
          sort($data[$zip][$city]);
          }
          }





          share|improve this answer












          Well, first of all this data must be stored in a database, not a file. Using PDO you'll get your array in a few lines (assuming a database connection is already established):



          $sql = "SELECT city, district FROM zip WHERE zipcode=? ORDER BY city, district";
          $stmt = $pdo->prepare($sql);
          $stmt->execute([$zipcode]);
          $data = $stmt->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_COLUMN);


          As of the code present, there are way too much loops to my taste. I believe everything could be done in one loop, like



          $data = ;
          foreach (file("zip.csv", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $row) {
          list($zip, $city, $district) = explode(",",$row);
          if (!isset($data[$zip])) {
          $data[$zip] = ;
          }
          if (!isset($data[$zip][$city])) {
          $data[$zip][$city] = ;
          }
          $data[$zip][$city] = $district;
          }


          well if you need to sort your arrays, a couple extra loops are still needed



          foreach ($data as $zip => $city) {
          ksort($data[$zip]);
          foreach ($data[$zip] as $city) {
          sort($data[$zip][$city]);
          }
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 34 mins ago









          Your Common Sense

          3,301526




          3,301526
























              up vote
              0
              down vote













              Some extra inspirational stuff ;)



              // Load your CSV into array
              $zipcode = '67401';
              $options = ;
              $fh = fopen('zip.csv', 'r');
              while (($data = fgetcsv($fh)) !== false) {
              if ($zipcode == $data[0]) {
              list($zip, $city, $district) = $data;
              $options[$city][$district] = $district;
              }
              }
              fclose($fh);

              // Sort cities
              ksort($options);

              // Sort districts
              array_walk($options, function(&$districts) {
              ksort($districts);
              });

              // Enjoy!
              print_r($options);




              share








              New contributor




              Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






















                up vote
                0
                down vote













                Some extra inspirational stuff ;)



                // Load your CSV into array
                $zipcode = '67401';
                $options = ;
                $fh = fopen('zip.csv', 'r');
                while (($data = fgetcsv($fh)) !== false) {
                if ($zipcode == $data[0]) {
                list($zip, $city, $district) = $data;
                $options[$city][$district] = $district;
                }
                }
                fclose($fh);

                // Sort cities
                ksort($options);

                // Sort districts
                array_walk($options, function(&$districts) {
                ksort($districts);
                });

                // Enjoy!
                print_r($options);




                share








                New contributor




                Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Some extra inspirational stuff ;)



                  // Load your CSV into array
                  $zipcode = '67401';
                  $options = ;
                  $fh = fopen('zip.csv', 'r');
                  while (($data = fgetcsv($fh)) !== false) {
                  if ($zipcode == $data[0]) {
                  list($zip, $city, $district) = $data;
                  $options[$city][$district] = $district;
                  }
                  }
                  fclose($fh);

                  // Sort cities
                  ksort($options);

                  // Sort districts
                  array_walk($options, function(&$districts) {
                  ksort($districts);
                  });

                  // Enjoy!
                  print_r($options);




                  share








                  New contributor




                  Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  Some extra inspirational stuff ;)



                  // Load your CSV into array
                  $zipcode = '67401';
                  $options = ;
                  $fh = fopen('zip.csv', 'r');
                  while (($data = fgetcsv($fh)) !== false) {
                  if ($zipcode == $data[0]) {
                  list($zip, $city, $district) = $data;
                  $options[$city][$district] = $district;
                  }
                  }
                  fclose($fh);

                  // Sort cities
                  ksort($options);

                  // Sort districts
                  array_walk($options, function(&$districts) {
                  ksort($districts);
                  });

                  // Enjoy!
                  print_r($options);





                  share








                  New contributor




                  Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.








                  share


                  share






                  New contributor




                  Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 4 mins ago









                  Victor

                  1113




                  1113




                  New contributor




                  Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Victor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Code Review Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f209825%2fphp-select-data-from-csv-and-make-associative-array%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Quarter-circle Tiles

                      build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

                      Mont Emei