开发者

Passing false values showing up as blank in var_dump

I am calling a stored procedure that takes an boolean argument. True values are easily passed as a 1 in my code, but false values are showing up blank. However, my var_dump shows that my value is actually false.

$form[$i]['photo_op'] = isset($_POST['photo_op'][$array_i]) ? $_POST['photo_op'][$array_i] : false;

My $_POST var_dump looks something like:

["photo_op"]=> bool(false) ["gala"]=> bool(true) ["chairman"]=> bool(false)

When I开发者_运维问答 print out my values, it seems to be passing in empty strings for my 'photo_op' and 'chairman' fields:

foreach($form as $f){
    print "Photo OP: " . $f['photo_op'] . " | Gala: " . $f['gala'] . " | Chair: " . $f['chair'];
}

My output looks like: Photo OP: | Gala: 1 | Chair:

My goal is to pass the false values to a stored procedure:

$final = insertAttendeeInfo($ind_id, $f['photo_op']);

The stored procedure looks something like:

function insertAttendeeInfo($ind_id, $photo){
   $insert = dbStoredProc('sp_remove_attendee_information', $ind_id, $photo);
   return;
}

Any ideas?

Thank you in advance.


When you print a variable using the print function (or when you concatenate a variable to a string), its value gets converted to a string. A boolean false is converted to an empty string. If you want to see the true value of a variable use var_dump or var_export instead of print.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜