[英]Checking if a array is empty or not set in php?
I'm currently using: 我目前正在使用:
if (isset($get['when']) && !strtotime($get['when']) && strtotime($get['when']) < time())
But i would also like it to include a way to check if $get['when'] is empty('')
. 但我也希望它包含一种检查
$get['when'] is empty('')
。 How do I do this in the best manner? 如何以最佳方式做到这一点?
empty( $get['when'] )
will return true
if $get['when']
is an empty string. 如果
$get['when']
为空字符串,则empty( $get['when'] )
将返回true
。 See the manual's entry on empty
for more info. 有关更多信息,请参见本手册的
empty
条目 。
if (isset($get['when']) && !empty($_GET['when']) && !strtotime($get['when']) && strtotime($get['when']) < time())
在检查$ _GET ['when']设置后,立即使用空函数。
if(isset($get['when']) && !empty($get['when']) ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.