2
I have a multidimensional array, as the example below shows, but I wonder, if I can use a Heredoc on it, would it be possible? I could include special characters not escaped, if it is possible to use the Heredoc?
$name_code = array
(
array("Nome", "HEREDOC"),
);
Code Heredoc which it intended to use in the array().
$script = <<<CODE
rand@#¨4key"'?></
CODE;
Below is my attempt, which failed.
$name_code = array
(
array("Nome", $script = <<<CODE
rand@#¨4key"'?></
CODE;),
);
You tried and gave trouble?
– Bacco
Yes
Parse error: syntax error, unexpected end of file in
, I do not know if I was very clear, but I would like to user directly in the array, I added the question what I tried to do. I would like to have everything just in the array, and not out of it, leaving the code the most clean possible, facilitating upgrade/maintenance.– Florida
The way it is the code will not work anyway.. you must set the variable
script
outside thearray
, here it works: https://ideone.com/mKln9g– stderr
@zekk the biggest problem is in CODE;
– Bacco
@Florida care that in this case, the white spaces are part of the string.
– Bacco