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

后端 未结 15 2215
小鲜肉
小鲜肉 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:54

    I'd suggest using $_POST and $_GET explicitly.

    Using $_REQUEST should be unnecessary with proper site design anyway, and it comes with some downsides like leaving you open to easier CSRF/XSS attacks and other silliness that comes from storing data in the URL.

    The speed difference should be minimal either way.

提交回复
热议问题