Avatar of mhoggatt1

asked on 

Conditional statement

Back in the 70s my programming experience was in assembly language. So I am not programming anymore having been retired for some time. I am barely familiar with PHP and need your expert help in writing a simple text file routine that will be a help to me in my Bible study.

      I copy and paste the Scripture verse into a text file called strongs.txt and this is what the text file looks like:

Matthew 5:5 Blessed 3107  are the meek: 4239  for 3754  they 846  shall inherit 2816 5692  the earth 1093 .

This is a simple routine that I copied off the Internet and that's as far as I've been able to go and I'm not sure if it will even work for what I need to do or not:

$myfile = fopen("strongs.txt", "r") or die("Unable to open file!");
// Output one character until end-of-file
 while(!feof($myfile)) {
   echo fgetc($myfile);}


And it does print out the file strongs.txt when run in my browser.

Here is the format I need the file to be in:
Matthew 5:5 Blessed 3107 
are the meek: 4239 
for 3754 
they 846 
 shall inherit 2816 5692 
the earth 1093 .

The text file strongs.txt and the word phrase associated numbers are separated by double spaces. So I would presume some kind of conditional statement would be needed to test for the double spaces then print the line into a new file with a return to place them on separate lines. Not being familiar with PHP what would you suggest? Any coding that would complete this routine would be greatly appreciated. Hope this all makes sense,


Avatar of undefined
Last Comment

8/22/2022 - Mon