hi
i'm quite new to php and have a little question. how can i replace %string% trough array[string]??
greets RaCCa
replace strings
Moderator: General Moderators
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
i know bech100 is browsing these forums so im gonna be quick!
string replace
eg
hope that helps
string replace
eg
Code: Select all
$motd = "/etc/motd";
$file = fopen("$motd", "r");
$content = fread($file, filesize($motd));
$content2 = str_replace("\n", "<br>", $content);
fclose($file);
print $content2;thanks, i tried it with the str_replace function but i don't know how to do use it, so that i can replace %number% with $nameofthearray[number].
i think i have to begin with
but how can i put the number between the '%' into the array?
could you explain to me how to use the function in that case?
thanks very much, racca
i think i have to begin with
Code: Select all
str_replace("%*%",could you explain to me how to use the function in that case?
thanks very much, racca