+ 6
Which one is recomended? echo ("Some_text") or echo "Some_text"
OK I got it.. echo behaves like a function but it really is a Language constructor... so, in this diverse world of navigators, cell phones and tablets someone like me start to wonder... which one is better to use (in term o compatibility): echo ("Some_text") or echo "Some_text"... and is there any exception to the rule where is better to use the other way around?
8 odpowiedzi
+ 6
it's both possible but I only use echo "some_text” and there isn't a compatibility problem. The parentheses aren't necessary because echo isn't a function.
+ 2
Hmm as far as I know php converts everything to the right type at the right time. So when you use echo, php automatically converts the value to a string...
$number=1;
echo $number;
outputs 1
0
I thought the parentheses were to indicate that it was a String...
0
mm.. but that is in the case that you put a variable after the echo... but if you want the word "hello" to appear in the browser and write:
echo hello;
You will get and error...
0
for sake of consistancy i use echo( "..." ) ;
0
well using the echo("....") seams more professional (makes your code look good and clean) but I does not matter, it does the same thing as the echo "...". So just choose one and stick to it.
0
Nelson Urbina the double quotes " .." are used to indicate that any thing is a string not the parenthesis.
0
the best ways is echo "....";