Jump to content


Photo

E_STRICT


  • Please log in to reply
2 replies to this topic

#1 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 18 April 2006 - 01:33 PM

Hi guys,

I'm not sure about the knowledge level of this topic, so, here I am.. =) another newbie question!

I was studing a little more about security, scripts, code standart.. and found this one.. so I've read:

"Avoid warnings of E_STRICT mode"

The code just test this one with error_reporting(0) and.. well.. o-o" i don't understood this.

What is this E_STRICT and how useful is it?

---
edit:
I dont want to create a topic to this question, so I will use this..
I've seen it: if ( !@$color )
!@? What its do??
---

=) Thank anyway..

D.Soul
(If something is wrong, please tell me. I'm learning this language. Thank you)

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 18 April 2006 - 05:46 PM

E_STRICT is an error reporting level. But it doesnt return errors in your code but PHP will suggest changes to be made to your code which will ensure the best interoperability and forward compatibility of your code.

The thing about !@ is a form of lasy programming, apart form the ! symbol. The ! symbol is a comparison operater which means not in PHP terms. For example you want to check a variable is not set you'll do this:

if(!$var)
{
    //set $var
    $var = "something";
}
Now when you run that code you are likely to get a php notice error which says var is not defined, meaning var is a non existent variable in your script. What (lazy) programmers tend to do is place an @ symbol in front of $var. The @ supresses the error message meaning no error is shown. But this is lazy! I tend to do the following:
if(!isset($var))
{
    //set $var
    $var = "something";
}
isset does what the function is called all it does is check whether a variable is actually set. The allows me not to be tempted to use the @ symbol.

Hope that helps.

#3 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 18 April 2006 - 07:34 PM

That helps a lot..

I use isset to do it, but never seen before that @.. that's why I'm surpriesed!!

About the E_Stritc.. so, this may help me to make a better code.. if someone is ugly, the php will "warning me", rigth?

Hmmm, it's look cool, need to learn how to use this =D

Thanks,

D.Soul
(If something is wrong, please tell me. I'm learning this language. Thank you)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users