How should I format very long strings in my source code?
I follow the rule, that line of code should not be longer than 80 characters.
(The other rules are Zend Framework formatting standard)
e.g.
protected $_messages = array(
'key1' => 'very, very long string lorem ipsum dolor sit amet…',
'key2' => 'this one it very long too, and exceeds 80 characters len…'
);
If you cannot store the values in a DB/file (as per adam/Peter), and you absolutely need to keep the 80/120 character limit as per Zend Framework guidelines, then you can adhere to them even in this case.
As per:
http://framework.zend.com/manual/en/coding-standard.coding-style.html
String Concatenation (one level extra indentation)
Associative Arrays (one level extra indentation)
The above two combined (two level extra indentation for long strings)
Edit:
The above does not work (thanks & sorry takeshin), as PHP does not seem to allow any code/operators in initial values of class properties.
The solution is to concatenate and set the initial values in class constructor: