Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $file = 'file.txt';
- $data = file_get_contents($file);
- $output = [];
- foreach (explode("\n", $data) as $line) {
- $output[] = explode('|', $line);
- }
- if (empty(end($output)[0])) {
- unset($output[count($output) - 1]);
- }
- $json = json_encode($output);
- echo '<pre>'; print_r( $json ); echo '</pre>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement