Jump to content

Archived

This topic is now archived and is closed to further replies.

Darkness Soul

E_STRICT

Recommended Posts

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:

[b]"Avoid warnings of E_STRICT mode"[/b]

The code just test this one with [b]error_reporting(0)[/b] 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

Share this post


Link to post
Share on other sites
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 [b]not[/b] in PHP terms. For example you want to check a variable is not set you'll do this:

[code]if(!$var)
{
    //set $var
    $var = "something";
}[/code]
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:
[code]if(!isset($var))
{
    //set $var
    $var = "something";
}[/code]
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.