Search code examples
phpcharacter-encodinghttp-status-code-500

PHP Special chars escape


I have a password with special chars in my php file.
The original String returns a 500 html error code.
The following chars are the root cause.

()[]$

The line of code is: private $password = "abc(de)fgh[ijk]lmn$opq$";

How can I correctly escape those chars?
I have tried to replace them with the HTML charset, as well as \\


Solution

  • Single quotes are the simplest way to make a string. They just display what they are given, no bells and whistles, no special "powers" like being able to show variable values.

    Use Single quotes.