In an array, how do you make a value ( in a key / value pair ) equal to a variable?
<p>For example I have this in a class:</p>

<pre><code>private $messages = array( 
    'name'=&gt;        '&lt;aa_f&gt;name',
    'PASS' =&gt;       '&lt;aa_p&gt;'
);
</code></pre>

<p>but I want to make <code>&lt;aa_p&gt;</code> a variable like this:</p>

<pre><code>private $pass = '&lt;aa_p&gt;';
</code></pre>

<p>I've tried these 4 ways and none work.  PHP.net had no example of doing this.</p>

<pre><code>    'PASS' =&gt;       $this-&gt;pass
    'PASS' =&gt;       $pass
    'PASS' =&gt;       '$this-&gt;pass'
    'PASS' =&gt;       '$pass'
</code></pre>

<p><strong>Full Code</strong></p>

<pre><code>&lt;?php
class Message
{
    private $PASS = '&lt;aa_p&gt;';
    private $FAIL = '&lt;aa_f&gt;';

    private $messages = array( 
        'name'=&gt;        '&lt;aa_f&gt;name',
        'email' =&gt;      '&lt;aa_f&gt;email_s', 
        'pass' =&gt;       '&lt;aa_f&gt;pass',
        'url' =&gt;        '&lt;aa_f&gt;url',
        'title' =&gt;      '&lt;aa_f&gt;title',
        'tweet'=&gt;       '&lt;aa_f&gt;tweet',
        'empty' =&gt;      '&lt;aa_f&gt;empty', 
        'same' =&gt;       '&lt;aa_f&gt;same',  
        'taken' =&gt;      '&lt;aa_f&gt;taken', 
        'validate' =&gt;   '&lt;aa_f&gt;validate',
        'PASS' =&gt;       '&lt;aa_p&gt;'
    );
    public function __construct()
    {
    }
    public function display($type)
    {
        echo $this-&gt;messages[$type];
    }
    public function get($type)
    {
        return $this-&gt;messages[$type];
    }
}
</code></pre>

<p><strong>Update : Answer</strong></p>

<p>For Reference: ( Updated Code )</p>

<pre><code>class Message
{
    private $PASS = '&lt;aa_p';
    private $FAIL = '&lt;aa_f&gt;';
    private $messages = array();

    public function __construct()
    {
        $this-&gt;messages['PASS'] = $this-&gt;PASS;
        $this-&gt;messages['name'] = $this-&gt;FAIL . 'name';
        $this-&gt;messages['email'] = $this-&gt;FAIL . 'email_s';
        $this-&gt;messages['pass'] = $this-&gt;FAIL . 'pass';
        $this-&gt;messages['url'] = $this-&gt;FAIL . 'url';
        $this-&gt;messages['title'] = $this-&gt;FAIL . 'title';
        $this-&gt;messages['tweet'] = $this-&gt;FAIL . 'tweet';
        $this-&gt;messages['empty'] = $this-&gt;FAIL . 'empty';
        $this-&gt;messages['same'] = $this-&gt;FAIL . 'same';
        $this-&gt;messages['taken'] = $this-&gt;FAIL . 'taken';
        $this-&gt;messages['validate'] = $this-&gt;FAIL . 'validate';
    }
    public function display($type)
    {
        echo $this-&gt;messages[$type];
    }
    public function get($type)
    {
        return $this-&gt;messages[$type];
    }
}
</code></pre>
