Hi all,
I'm trying to create a simple class that will set a bunch of default values and do some other things as well.
The glitch is that for ease of configuration, I want to store these default values in a separate file and just include them in my class, but this is creating errors for me.
ie:
config.php:
<?php
$CONFIG_VAR1 = "default"
?>
class.php:
<?php
class myClass
{
include ("config.php");
var $var1
function myClass($var1=$CONFIG_VAR1)
{
$this->var1=$var1;
}
}
?>
I'm getting this error:
parse error, expecting T_OLD_FUNCTION' orT_FUNCTION' or T_VAR' or'}''
in relation to the line
'include("config.php");'
and it doesn't seem to make a difference if I put the include line outside of the class.
Are there issues with including external files in a class? It seems to me this should be possible, but I am fairly new to php, so any guidance would be much appreciated 🙂
Thanks,
Eric