Skip to content

Instantly share code, notes, and snippets.

@nptoan193
Created February 22, 2017 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nptoan193/a9fb855b1d68e826cf182916862f6e38 to your computer and use it in GitHub Desktop.
Save nptoan193/a9fb855b1d68e826cf182916862f6e38 to your computer and use it in GitHub Desktop.
<?php
$get_file= file_get_contents('C://xampp//htdocs/Resources/data.txt');
//echo $get_file;
$_list = explode("\n", $get_file);
foreach ($_list as $key => $value) {
$_list_temp = explode(";", $value);
$_list_1[$_list_temp[0]] = $_list_temp[1];
$_list_2[$_list_temp[1]][] = $_list_temp[0];
}
print_test($_list_1);
print_test($_list_2);
function print_test($_list){
echo '<pre>';
print_r($_list);
echo '</pre>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment