chocopi Posted June 12, 2007 Share Posted June 12, 2007 At the moment i have a list of all these different str_replaces and i just think it is wasting too much space. Id there a way i could store them in a .txt file and then take them when neccessary, i will show you what i mean in bb.txt [red]:<font color="#ff0000"> [/red]:</font> then in the actual file have something like this: <?php $text = $_POST['text']; $file = file_get_contents('bb.txt'); $line = explode("\n",$file); list($part1,$part2) = explode (':',$line); $text = str_replace($part1,$part2,$text); ?> However i think that for this to work, i will need a loop If you can shed some light, i would be greatful ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/55289-split-str_replace-loop/ Share on other sites More sharing options...
chigley Posted June 12, 2007 Share Posted June 12, 2007 <?php $text = $_POST["text"]; $lines = file("bb.txt"); foreach($lines as $line) { list($find, $replace) = explode(":", $line); $text = str_replace($find, $replace, $text); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/55289-split-str_replace-loop/#findComment-273283 Share on other sites More sharing options...
chocopi Posted June 12, 2007 Author Share Posted June 12, 2007 kool thanks Chigley, once again you saved my butt Quote Link to comment https://forums.phpfreaks.com/topic/55289-split-str_replace-loop/#findComment-273313 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.