Created
January 27, 2014 20:18
-
-
Save hciudad/8656418 to your computer and use it in GitHub Desktop.
Using heredocs in a PHP array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This actually works | |
$my_array = array( | |
'foo' => <<< FOO | |
It's time for | |
some foo, baby! | |
FOO | |
, | |
'bar' => <<< BAR | |
Now let's bar it up. | |
BAR | |
, | |
'hello' => 'world' | |
); | |
print_r($my_array); | |
// Array | |
// ( | |
// [foo] => It's time for | |
// some foo, baby! | |
// [bar] => Now let's bar it up. | |
// [hello] => world | |
// ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Weird white-space preservation even without the explicit HEREDOC endings. That's a spicy meatball.