can I replace
if(!$mail->Send()) {
return false;
} else {
return true;
}
with this?
return (bool)$mail->Send();
regardless of what $mail->Send() is returning (it is a three party object)
is there any type where (bool) acts diferent of the exclamation mark?
Yes, typecasting to the following types is allowed:
The casts allowed are:
- (int), (integer) - cast to integer
- (bool), (boolean) - cast to boolean
- (float), (double), (real) - cast to float
- (string) - cast to string
- (array) - cast to array
- (object) - cast to object
- (unset) - cast to NULL (PHP 5)
Otherwise, it's also possible to use
return !!$mail->Send();
however, that's not very obvious for someone else looking through your code in the future.
Yes you can, and if it's not working you could do this: return !!$mail->Send();.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With