'how to apply a text string in a variable with rename function

When using the PHP rename function I need to use text in a variable in the rename, but I can only get the rename to work when I manually enter the text, for example

If I use this

$original_file_name = '/my_file_path/Genesis _ Mad Man Moon _ A Trick Of The Tail (2007 Remaster) HQ Audio (128 kbps).mp3'; 

in rename like this

rename($filePath, $original_file_name); 

it works

But if I do this

$a = "'";
$b = '/my_file_path/';
$c = $fin_name;
$original_file_name = $a.$b.$c.$a;

I get this

'/home2/ricstrav/domains/nerjabible.com/public_html/plupload_latest/Genesis _ Mad Man Moon _ A Trick Of The Tail (2007 Remaster) HQ Audio (128 kbps).mp3

' with the end quote spaced two lines down from the end of the line so it does not rename.

Since I made this post, I have been thoroughly testing different options of rename, so far i have established the following

I am using this line of code to rename a file that has been uploaded to my server rename("{$filePath}.part", $original_name);

Where filePath is this file file_6278ea910fbf3 and the rename $original_name is the variable which contains the text ine below

Genesis _ Mad Man Moon _ A Trick Of The Tail (2007 Remaster) HQ Audio (128 kbps).mp3

when the rename fuction completes the file file_6278ea910fbf3 disappears off the directory on the server, but if I use this

rename("{$filePath}.part", "Genesis _ Mad Man Moon _ A Trick Of The Tail (2007 Remaster) HQ Audio (128 kbps).mp3");

It works perfectly

How can I make the variable $original_name reflect the same text, is there a 'normlising' option in php?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source