Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>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.</p> <p>As per: <a href="http://framework.zend.com/manual/en/coding-standard.coding-style.html" rel="nofollow noreferrer"><a href="http://framework.zend.com/manual/en/coding-standard.coding-style.html" rel="nofollow noreferrer">http://framework.zend.com/manual/en/coding-standard.coding-style.html</a></a></p> <p><strong><em>String Concatenation</em></strong> (one level extra indentation)</p> <pre><code>$sql = "SELECT `id`, `name` FROM `people` " . "WHERE `name` = 'Susan' " . "ORDER BY `name` ASC "; </code></pre> <p><strong><em>Associative Arrays</em></strong> (one level extra indentation)</p> <pre><code>$sampleArray = array( 'firstKey' =&gt; 'firstValue', 'secondKey' =&gt; 'secondValue', ); </code></pre> <p><strong><em>The above two combined</em></strong> (two level extra indentation for long strings)</p> <pre><code>protected $_messages = array( 'key1' =&gt; 'very, very long string ' . 'lorem ipsum dolor sit amet…', 'key2' =&gt; 'this one it very long too, ' . 'and exceeds 80 characters len…' ); </code></pre> <hr> <p><strong><em>Edit:</em></strong><br /> The above does not work (thanks &amp; sorry takeshin), as PHP does not seem to allow any code/operators in initial values of class properties.</p> <p>The solution is to concatenate and set the initial values in class constructor:</p> <pre><code>&lt;?php class bar { protected $_messages = Array(); public function __construct() { // manually initialize, or load from DB/XML/etc $this-&gt;_messages[] = "very, very long string " . "lorem ipsum dolor sit amet"; $this-&gt;_messages[] = "this one it very long too, " . "and exceeds 80 characters len"; var_dump( $this-&gt;_messages ); } } $foo = new bar(); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload