0

I figured out that the line

echo value;

print "value" in the page, when there is no '$' symbol and there is no define.

Also, it doesn't work if there is a space in it, i.e. :

echo hel lo;

doesn't work.

How is this possible, and is it dangerous to use this method instead of using " " ?

Thanks for your answers !

Stovent
  • 21
  • 3
  • 4
    `echo value` should print a warning, that no constant `value` is defined, assuming you mean `"value"` – king_nak Sep 25 '17 at 08:13
  • 1
    you need to turn on php error reporting to see whats happening. – nithinTa Sep 25 '17 at 08:15
  • @king_nak a notice, along with the values as it would convert the values to strings. – teeyo Sep 25 '17 at 08:15
  • @stovent if you want to echo a lot of values you need to add comma instead of space ! `echo hel, lo;` instead of `echo hel lo;` – teeyo Sep 25 '17 at 08:16
  • [link](https://stackoverflow.com/questions/2406006/is-there-any-legitimate-use-for-bare-strings-in-php) is the answer I was searching for, I just didn't knew what to wrtite in Google to get it. Also, thanks @teeyo for the advice. – Stovent Sep 25 '17 at 09:21

0 Answers0