I need to replace file extensions that are not equal to .php using preg_replace()
Let's say I have the following strings to be replaced:
form.c
library.h
module.php
index.html
common.inc
data
helpers.inc.bak
basically, I need to replace all of the strings where the extension is not equal to .php and change the extension to .php
example expected result:
form.c becomes form.php
library.h > library.php
module.php > module.php (stays the same)
index.html > index.php
common.inc > common.php
data > data (stays the same since there is no extension to replace)
helpers.inc.bak > helpers.inc.php
Let me know if you need more info. Thanks in advance.