Jump to content

split + str_replace + loop


chocopi

Recommended Posts

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  ;D

 

~ Chocopi

Link to comment
https://forums.phpfreaks.com/topic/55289-split-str_replace-loop/
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.