开发者

PHP if statment question

开发者 https://www.devze.com 2023-02-15 12:23 出处:网络
I have a simple question. So I have this code in my php file: if(empty($_POST[\'height\'])) { $width = \'385\';

I have a simple question. So I have this code in my php file:

if(empty($_POST['height'])) { 
$width = '385';
}

is it possible to do something like this?

if value of ($_POST['height'开发者_StackOverflow社区] is 'height' then $width ='385'; instead of if empty?


Do you mean;

if (!empty($_POST['height']) && $_POST['height'] == 'height') {
    $width = '385';
}

Update

Based on the comment, the solution would be:

if (array_key_exists('height', $_POST) && $_POST['height'] == 'height') {
    $width = '385';
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号