Php echo simple expression

I watched a tutorial on programming php echo statements and how to add variables to echo statements. It was just the way he did it, compared to my own method, I'm a little worried. I am very new to php and I am wondering if you are using a bad method or something.

That's what he does

echo "Example ".$example;

That's what I'm doing

echo "Example $example";

My method works, but I don’t want to get used to doing something that might cause errors or something like that. Can someone please tell me if my method is a good method or not.

+4
source share
1 answer

According to the PHP.NET documentation, its method is correct.

http://php.net/manual/en/language.operators.string.php

echo "Example " . $example;
+1
source

All Articles