That's confused me a few times in looking at this code. Not sure why the form name and field name aren't consistent, it would surely be easier.
Well, this explains the
strlen() error - you can see that where everything else is being passed as a string, the
opt-out field is being passed as an array. The only question now is, why? OK, this is the html code from your form, and this is why it comes in as an array:
<input type="checkbox" id="opt-out_0" name="opt-out" value="1" class="form-check-input">Unsubscribe
This section from the documentation for PHP Form builder says
* Adds checkbox to $group_name
* @param string $group_name The checkbox groupname (will be converted to an array of indexed value)
that the checkbox will always be converted to an array, so it looks like you don't have much choice but to refer to it as:
when you want to use it in your PHP code.