Require_once external vars and share those with other funcions in a php class
- by frx08
Hi all, I have an external file with some vars to require in my php class and share those with all functions of my class:
vars.inc:
<?php
$a = 1;
?>
class.php:
<?php
class A{
public function __construct(){
require_once("vars.inc");
}
public function aB{
echo $a;
}
}
?>
but it doesn't work: the $a var is undefined
how can I do?
thanks all