Help with str_replace()

From: Date: Wed, 03 Feb 2016 18:06:49 +0000
Subject: Help with str_replace()
Groups: php.general 
Request: Send a blank email to php-general+get-325376@lists.php.net to get a copy of this message
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

« previous php.general (#325376) next »