I have a file with a passage on it (Assignment2inputfile.txt). I can open that file just fine. I have another file (stopwords) that has a list of words that, if found in Assignment2inputfile, need to be replaced with the word "stop" (I put it in all caps in the code so I can see immediately when it works). I feel like I'm right on the edge of what I need, but the replacement is not happening. This is an exercise, so that's why my variables are named very generally or with what they are doing (chng -> change -> changing the original file ; $new -> the result of the changes)
$x = file_get_contents('Assignment2inputfile.txt');
$chng = str_replace("stopwords",'STOP', $x);
$new = file_put_contents('Assignment2inputfile.txt', $chng);
echo $new;