Hi. I'm just a noob in php. I need to know how I can replace a specific line of text in a php file. For example, in a php file below named conf.php, I want 'used_dir' => 'files/',, which is in the third line, to be replaced with 'used_dir' => 'new_files/',. How can i do this? Any reply will be appreciated.

PHP Code: 
<?php
$options 
= array (
'used_dir' => 'files/',
'login' => true,
);
?>
PS: I was thinking I can apply file_get_contents() and file_put_contents() functions in this but I don't have an idea how to.
techdaemon Reviewed by techdaemon on . replace a specific line in a php file Hi. I'm just a noob in php. I need to know how I can replace a specific line of text in a php file. For example, in a php file below named conf.php, I want 'used_dir' => 'files/',, which is in the third line, to be replaced with 'used_dir' => 'new_files/',. How can i do this? Any reply will be appreciated. <?php $options = array ( 'used_dir' => 'files/', 'login' => true, ); ?> PS: I was thinking I can apply file_get_contents() and file_put_contents() functions in this but I don't Rating: 5