Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Read string in file and place in array
<?php
$file = file_get_contents("filename.txt");
$data = preg_replace("/[^A-Za-z0-9 ]/", '', $file);
$result = preg_split("/[\s,]+/", $data);
echo $result[1];
echo $result[2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.