troubleshooting Question

Conditional statement

Avatar of mhoggatt1
mhoggatt1 asked on
20 Comments4 Solutions107 ViewsLast Modified:
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,

Marco Gasi

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2010

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 4 Answers and 20 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 4 Answers and 20 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004