php.ini: strings outside of quotes

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

php.ini: strings outside of quotes

Post by panic! »

Hello all,

for some reason in my scripts i can use


print hello;

instead of

print "hello";

and they both do the same thing, is there anyway I can make this throw up an error instead of letting me print it?

-Thanks in advance
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Check your error_reporting level. It's issuing a notice or warning and assuming a constant I believe.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Notice: Use of undefined constant hello - assumed 'hello'
One of the more annoying features of php.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

volka wrote:
Notice: Use of undefined constant hello - assumed 'hello'
One of the more annoying features of php.
sorry for offtopic but why is this annoying feature?
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Post by panic! »

I dunno if you're talking to me.

but i just think being able to use


print hello;

could potentially bring up some weird stuff.

like maybe if i used

print mysql_error instead of mysql_error()

by accident...
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

panic! wrote:I dunno if you're talking to me.

but i just think being able to use


print hello;

could potentially bring up some weird stuff.

like maybe if i used

print mysql_error instead of mysql_error()

by accident...
just develop on error_reporting(E_ALL)

as long as you don't have notices,warnings etc...
there will be no accident/weird stuff. programming language cannot protect you from "shooting yourself".
Post Reply