Home  >  Article  >  Backend Development  >  Is there any key in php that can be used with an array without using isset check?

Is there any key in php that can be used with an array without using isset check?

WBOY
WBOYOriginal
2016-08-08 09:06:441125browse

I have used a framework before, called speedPHP, which is rarely used by people. When using it, any key values ​​​​of these arrays such as session, get, post are not used isset, see I looked at its source code and didn’t see where it was set up. Recently, I thought this framework was slow, so I wrote a framework myself. I always have to isset when writing, especially when submitting a form. It can be written very quickly. Yes, I ended up writing for a long, long time, all while writing isset. So I want to ask if there is a way without writing isset? Also keep error reporting.


Some people may say that this approach will screw me up in the end, but I have used that framework for more than a year, and I have never been screwed by the "no isset" thing...


I woke up this morning and thought about it. I thought it had some kind of fault-tolerance settings. This morning I thought, maybe it was just the debug type that had been changed. Then I looked at its debug settings, and sure enough...

if( substr(PHP_VERSION, 0, 3) == "5.3" ){
    error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
}else{
    error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
}

speedPHP is written like this. After I copied these, sure enough, no errors were reported. It’s not that there were no errors, but no errors were reported.

Reply content:

I have used a framework before, called speedPHP, which is rarely used by people. When using it, any key values ​​​​of these arrays such as session, get, post are not used isset, see I looked at its source code and didn’t see where it was set up. Recently, I thought this framework was slow, so I wrote a framework myself. I always have to isset when writing, especially when submitting a form. It can be written very quickly. Yes, I ended up writing for a long, long time, all while writing isset. So I want to ask if there is a way without writing isset? Also keep error reporting.


Some people may say that this approach will screw me up in the end, but I have used that framework for more than a year, and I have never been screwed by the "no isset" thing...


I woke up this morning and thought about it. I thought it had some kind of fault-tolerance settings. This morning I thought, maybe it was just the debug type that had been changed. Then I looked at its debug settings, and sure enough...

if( substr(PHP_VERSION, 0, 3) == "5.3" ){
    error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
}else{
    error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
}

speedPHP is written like this. After I copied these, sure enough, no errors were reported. It’s not that there were no errors, but no errors were reported.

Is there any key in php that can be used with an array without using isset check?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn