Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/7719-e_strict/
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.
Link to comment
https://forums.phpfreaks.com/topic/7719-e_strict/#findComment-28256
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
Link to comment
https://forums.phpfreaks.com/topic/7719-e_strict/#findComment-28293
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.