Every example I find for file_get_contents
and FILE_USE_INCLUDE_PATH
show the file name as a text string inside quotes. I see that the dot concatenation is used (I'm presuming to concatenate the PATH and the actual file name) and when I follow that method, my code works. However, I need to create a variable for the file name and when I do PHP stops.
I have set_include_path( PATH );
and I see the desired folder WITHOUT a forward slash (/).
I have tried both with and without a forward slash in front of the file name when I assign it to the variable ($var_ame = "file.dat";
) and ($var_ame = "/file.dat";
) with no difference.
This works: $expected_var = file_get_contents('./file.dat', FILE_USE_INCLUDE_PATH);
This DOES NOT: $expected_var = file_get_contents($var_name, FILE_USE_INCLUDE_PATH);
I have tried a dot in front of the variable knowing that I need to concatenate somehow but that stops PHP as well.
What am I missing here?