Last active
June 2, 2016 12:43
-
-
Save sarathlal-old/6de6dfd525f4cb5c3017a92ddcc385ba to your computer and use it in GitHub Desktop.
Add string on each line of a file content before or after the content. Just insert the file to be processed on the same directory in our server and call our script via browser.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$handle = fopen("file.txt", "r"); | |
if ($handle) { | |
while (($line = fgets($handle)) !== false) { | |
// process the line read. | |
echo "Text Before - " . $line . " - Text After<br>"; | |
} | |
fclose($handle); | |
} else { | |
echo "Error!<br>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment