Among $_REQUEST, $_GET and $_POST which one is the fastest?

后端 未结 15 2466
小鲜肉
小鲜肉 2020-11-22 05:04

Which of these code will be faster?

$temp = $_REQUEST[\'s\'];

or

if (isset($_GET[\'s\'])) {
  $temp = $_GET[\'s\'];
}
else          


        
15条回答
  •  独厮守ぢ
    2020-11-22 05:30

    Don't worry. But you should still use the second solution (plus an extra check for none of those variables existing), because there are security issues with $_REQUEST (since $_GET and $_POST aren't the only sources for that array).

    There was a post about the problems with $_REQUEST yesterday, I believe. Let me go find it.

    EDIT: Oh well, not directly a post, but here it is anyway: http://kuza55.blogspot.com/2006/03/request-variable-fixation.html

提交回复
热议问题