Using XML in PHP classes
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2202995/declare-property-as-object">declare property as object?</a><br>
  <a href="http://stackoverflow.com/questions/3960323/why-dont-php-attributes-allow-functions">Why don&#39;t PHP attributes allow functions?</a>  </p>
</blockquote>



<p>I'm trying to replicate the idea inspired by .NET's <code>web.config</code> by storing connection strings in an XML document.</p>

<p><br/>
but the problem is I keep getting an error everytime I try to load my XML file in the my class that would handle the database connectivity.</p>

<p>for example I have this XML markup:
<br/>
<strong>connections.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;connections&gt;
    &lt;connection name="MyConnection" 
                connectionstring="mysql:host=localhost;dbname=MyDatabase" 
                username="username" 
                password="password" /&gt;
&lt;/connections&gt;
</code></pre>

<p><br/>
and the PHP class that would handle it.
<br/>
<strong>Connection.php</strong></p>

<pre><code>&lt;?php
    class Connection {
        // I keep getting errors here
        protected $xml = simplexml_load_file("connections.xml");

        // rest of my code here...
    }
?&gt;
</code></pre>

<p><br/>
if it helps, here is the error message that is being thrown.</p>

<pre><code>Parse error: syntax error, 
             unexpected '(', expecting ',' or ';' in &lt;path&gt;\Connection.php on line 3
</code></pre>

<p>any help would be greatly appreciated, thanks. :)</p>
