Code:
Kudos to Almis for the original awnser, modified to fit your use a bit more and explained.
case 11:
$iwd = $GLOBALS["orig_filename"];
$zip = str_replace('.iwd', '.zip', $iwd);
rename($iwd, $zip);
break;
Explanation:
First of all, don't use shell_exec()
for an already built in PHP function rename
, usage here php.net/rename.
Second of all, str_replace()
provides the ability to replace an param 1 with param 2 www.php.net/manual/en/function.str-replace.php
And lastly, don't use globals they can make problems harder to diagnose among other things ref. https://stackoverflow.com/questions/1557787/are... If you still decide to use them, I find it better to use global $value
before needing the value in a separate function.