REGEX-Escape for: if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){ $_SERVER['HTTPS'] = 'on'; $_...

Your Input:
Result, the escaped string:
if\(\$_SERVER\['HTTP_X_FORWARDED_PROTO'\] \=\= 'https'\)\{ \$_SERVER\['HTTPS'\] \= 'on'; \$_SERVER\['SERVER_PORT'\] \= 8443; \}

What must the escaping look like for:
if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){ $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = 8443; }

The excaped text for use in a regex is:
if\(\$_SERVER\['HTTP_X_FORWARDED_PROTO'\] \=\= 'https'\)\{ \$_SERVER\['HTTPS'\] \= 'on'; \$_SERVER\['SERVER_PORT'\] \= 8443; \}