At first I thought, "well, thats easy". I am an old timer, my computer experience goes back to early '70's. "." for seperating entities goes back to the '60's! So php decides to use it for concatenation! no problem right? try using echo with a string that has a concatenated var that returns a filename such as "filename.txt", the period in the string gets parsed! Example: echo "This filename is ".$filename." some other text"; Code (markup): Now that I have vented, does anyone know of a solution?
LogicFlux is correct. Though, just as an alternative, you can also do this: <?php echo "This filename is {$filename} some other text"; PHP: This method will only work with double quotes. Not with single quotes.
You quoted the variable inside the string, you don't need to quote the variable inside the string if your string is already quoted. echo "This filename is $filename some other text"; PHP: You don't even need to use concatenation for this either, your not joining a variable with anything else you can reference that variable in the my example.
You don't need to, but a lot of people do it because their syntax highlighters make the variables easier to spot in the code. And there's nothing wrong with this. Alternatively, you can use commas rather than the periods. echo 'This filename is ', $filename, ' some other text'; PHP: