PHP Find and Replace characters
Posted: Mon Jun 23, 2003 2:39 pm
Can a person dump a text file into a database, then find and replace certain characters? How would you go about doing this...
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$file="<!--your_file-->";
$old = file ($file);
foreach ($old as $line_num => $line) {
//$word=explode(" ",$line);
//maybe an second loop with the word array
$line[]= str_replace ("<!--find_this-->","<!--replace_with_this-->",$line);
}
$new=implode("\n",$line);
?>