urlencode()
and urldecode()
are irrelevant, it is because of how you are entering the string in the source code.
To get the literal string this is data \\u003d\ this is data
from a string assignment in PHP source code enclosed in double quotes, single quotes, or a HEREDOC you must escape all of the backslashes.
Eg:
$string = 'this is data \\\\u003d\\ this is data';
$string = "this is data \\\\u003d\\ this is data";
$string = <<<_E_
this is data \\\\u003d\\ this is data
_E_;
This is because \
is always an escape character which must itself be escaped. A lone backslash does not necessarily need to be escaped, but if you don't then a following character can be interpreted as an escape sequence, such as \\
collapsing to \
as you've seen.
The exception being the NOWDOC, where there is no escaping at all.
$string = <<<'_E_'
this is data \\u003d\ this is data
_E_;
Ref: https://www.php.net/manual/en/language.types.string.php