Good day.
What I'm doing:
$str = "'"."a value"."'";
var_dump($str);
What I expect:
"'a value'"
What I recieve:
'a value'
Question: why? I am definitely NOT doing any transformation.
All values that are concatenated are strings, I've checked.
Output of the page sets header to be application/json, but I checked with text/html. Same result.
Tried shielding data as "\'", tried unhtmlspecialchars, tried json_decode. Same result.
magick_quotes - tried, not related, but tried. Same result.
Using Wamp(32) on Win7 php 5.3.13
UPDATE:
Just discovered that this happens ONLY in var_dump, while print_r and echo shows data as expected...
So - problem solved for a moment, but still - this is not a common behaviour, and an idea of - why it works that way would be appreciated.
Your quotes are misplaced:
$str = "'"."a value."'";
^ here you close the " but you don't concatenate using .
Should be:
$str = "'" . "a value. " . "'" . "";
Although I'm not sure what are you trying to achieve, you could write this string in easier ways than doing this, example in sandobx.