Well, I know this is a fairly common question, but all the solutions that I have found so far are related to the missing half-time or curly brace, both of which I know, are not for me.
I have a class that works with FINE with this variable assignment:
session.php:
<?php class session { ... var $host = 'localhost'; ... } ?>
Great. But I want my database data to be in a different file, so I did this:
db_creds.php:
<?php var $db_creds = array( 'host' => 'localhost', ... ); ?>
session.php
<?php include('db_creds.php'); class session { ... var $host = $db_creds['host']; ... } ?>
What then gave me this error: Parse error: syntax error, unexpected T_VARIABLE in ../session.php on line 74 , where line 74 is my destination var $host .
I even tried to do this in session.php , just to make sure the problem is not include:
session.php
<?php # include('db_creds.php'); class session { ... var $db_host = 'localhost'; var $host = $db_host; ... } ?>
... but this only causes the same error as above.
Can someone tell me what is going on here? I am on my way!
variables include php
neezer
source share