Re,
I use a shell command cat to dump multiple lines into a file like so:
cat > file <<CHAR
one
two
three
CHAR
Here's my problem: I need to execute the same cat command using shell_exec in PHP. How would I dump the contents of an array and terminate the command with CHAR? I know this sounds odd but I need to create a file using sudo and I don't want to dump everything into a temporary file and then sudo cp it to the intended location.
Thanks.