php - check if $_POST is array?

前端 未结 8 647
独厮守ぢ
独厮守ぢ 2020-12-21 14:58

I know this may be a silly question, but I come across a snippet of php code that check if the $_POST is_array() before execute other functions.

8条回答
  •  伪装坚强ぢ
    2020-12-21 15:16

    Its always an array as many already gave said.

    I think the intention is maybe to check for an empty array. !empty($_POST) should do just fine.

    Maybe the coder has sections where the array is changed to a string (dumb if you ask me) and wants to make the check, else if that statement comes first, then its unnecessary

提交回复
热议问题