You still don't know what I mean, but I found the solution already. The problem was: How do I get an outside variable from whithin a function.
Like this:
$var = "test";
function Speak() {
echo $var; // error
}
Solution:
$var = "test";
function Speak() {
global $var;
echo $var; // Will print "test"
}
chris wrote:
i know and what i am saying is that this will cause an error:
say = new speak;
say->hello();
this is the proper syntax and won't cause an error:
$say = new speak;
$say->hello();
now what exactly you are asking if you can do i don't think i understand. you have
$word = "hello";
then you define the class and create the object and all that. but you call the hello method and i don't see what you want it to do. the $foo variable is not set anywhere. so what do you want it to do?