I am trying to join several variables to create a file path. The file path changes each day and have set it up accordingly. The problem is that after I join them together they they delete them self and leave only the date. Here is the code
$filepath2 = "/data/";
$date = date(Ymd);
$unit = $_GET;
$part1 = strval($unit);
$part2 = strval($date);
$part3 = ".txt";
$filepath = $filepath2 + $part1 + $part2 + $part3;
echo $filepath;
The echo just comes back with 20120713 (the date). Where have I gone wrong?
To concatenate strings in PHP you are not supposed to use
+but the concatenation operator; the dot.Correction of the relevant line in your snippet:
You can read more about string operators by following the link below: