Where did you read that str_replace() uses regular expressions? May preg_replace(). On Wed, Feb 3, 2016 at 12:06 PM, Danny <mynixmail@xxxxxxxxx> wrote: > Hi guys, > > Can someone tell me why I am getting no output from the following file ... > > Explanation: > I send a number (via procmail) to this script. This script in turn takes > the > number ... opens up a file ... search for the previous number ... replace > the > previous number with the new number ... and then writes it to the file ... > > > ############################################################################################### > #!/usr/bin/php > <?php > while ( false !== ( $input = fgets ( STDIN ) ) ) > { > $old_number = "/((NUMBER_ID=)([0-9]{1,6}))/" ; > > $new_number = "NUMBER_ID=".$input ; > > $number_file = "NumberRotation.conf" ; > > $file_contents = file_get_contents ( $number_file, > FILE_USE_INCLUDE_PATH ) ; > $file_contents = str_replace ( $old_number, $new_number, > $file_contents ) ; > > file_put_contents ( $number_file, $file_contents ) ; > } > ?> > > ############################################################################################### > > Thank You > Danny > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >