Why not use a real boolean here? I'd write it as follows (so you also have $ssl_only = false):

```
$ssl_only = $ssl and $ssl_port == $listen_port
```