Jump to content

str_replace() with a text file


RobertSubnet

Recommended Posts

Greetings all.

 

I have a web site that uses long option lists and switch cases. Both of these use numerical sequences. When I make a change, re-ordering is a very long and tedious process. For example:

 

1 => apple

2 => pear

3 => grape

4 => banana

-------------

Insert orange in the #2 spot

 

1 => apple

2 => orange

3 => pear

4 => grape

5 => banana

 

Here the re-ordering is easy. But in my scripts, I have close to 200 options/switch cases.

 

What I am wondering is can I use str_replace() combined with a while loop to automate the process? With the subject (input file) being along the lines of:

 

$subject = './myfile.php';

 

Thanks,

~Robert

Link to comment
https://forums.phpfreaks.com/topic/148490-str_replace-with-a-text-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.