Advertisement
Guest User

Untitled

a guest
Jul 8th, 2017
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. Array
  2. (
  3. [0] => Array
  4. (
  5. [imie;nazwisko;telefon] => 3;email@gmail.com;888438734
  6. )
  7.  
  8. [1] => Array
  9. (
  10. [imie;nazwisko;telefon] => 6;email@gmail.com;500506518
  11. )
  12.  
  13. [2] => Array
  14. (
  15. [imie;nazwisko;telefon] => 7;email@gmail.com;500506514
  16. )
  17.  
  18. [3] => Array
  19. (
  20. [imie;nazwisko;telefon] => 16;email@gmail.com;512219888
  21. )
  22.  
  23. [4] => Array
  24. (
  25. [imie;nazwisko;telefon] => 17;email@gmail.com;796688012
  26. )
  27.  
  28. [5] => Array
  29. (
  30. [imie;nazwisko;telefon] => 19;email@gmail.com;507823044
  31. )
  32.  
  33. [6] => Array
  34. (
  35. [imie;nazwisko;telefon] => 32;email@gmail.com;695036055
  36. )
  37.  
  38. [7] => Array
  39. (
  40. [imie;nazwisko;telefon] => 39;email@gmail.com;600678649
  41. )
  42.  
  43. [8] => Array
  44. (
  45. [imie;nazwisko;telefon] => 50;email@gmail.com;504430005
  46. )
  47.  
  48. [9] => Array
  49. (
  50. [imie;nazwisko;telefon] => 52;email@gmail.com;606272420
  51. )
  52.  
  53. [10] => Array
  54. (
  55. [imie;nazwisko;telefon] => 54;email@gmail.com;502442927
  56. )
  57.  
  58. [11] => Array
  59. (
  60. [imie;nazwisko;telefon] => 720;email@gmail.com;668544084
  61. )
  62.  
  63. [12] => Array
  64. (
  65. [imie;nazwisko;telefon] => 54;email@gmail.com;500506307
  66. )
  67.  
  68. )
  69.  
  70. $csv = array_map("str_getcsv", file($path,FILE_SKIP_EMPTY_LINES));
  71. $keys = array_shift($csv);
  72. foreach ($csv as $i=>$row) {
  73. $csv[$i] = array_combine($keys, $row);
  74. }
  75. echo '<pre>';
  76. print_r($csv);
  77. echo '</pre>';
  78.  
  79. foreach($array as $arrIdx => $subArr){
  80. foreach($subArr as $keys => $values) {
  81. $key = explode(";", $keys);
  82. $value = explode(";", $values);
  83.  
  84. for($i=0; $i <= 2; $i++){
  85. echo $key[$i]." : ".$value[$i];
  86. }
  87. }
  88. }
  89.  
  90. $csv = array_map("str_getcsv", file($path,FILE_SKIP_EMPTY_LINES));
  91. $keys = explode(";", array_shift($csv));
  92. foreach ($csv as $i=>$row) {
  93. $csv[$i] = array();
  94. foreach (explode(";", $row) as $j => $element) {
  95. $csv[$i][$keys[$j]] = $element;
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement