I'm trying to parse a global variable inside a snippet that represents my page footer, and I want to perform a string function on the content of that variable. The snippet is being called into a template with PHP parsing ON and set to OUTPUT. This is the code I'm having trouble with:
<?php echo trim(str_replace(array("\r\n","\n","\r"), ', ', "{address}")); ?>
The value of the variable is (for example):
Big Company
Main Street
Big Town
And I want it to be:
Big Company, Main Street, Big Town
But PHP is trying to modify the string "{address}" not the actual value of the address variable, so I just end up with the original content (address with line breaks) when the EE parses the result of that function which is {address} in the template.
What am I doing wrong?
EE 2.6.1