Sorry but I still cant seem to figure it out... will you please have a look at this simple class :
Class :
<?php
// PHP
// Class Definition
class Bear {
// define Properties
public $name;
public $weight;
public $age;
public $sex;
public $color;
// Define Methods
public function eat() {
echo $this->name . " is eating...\n";
}
public function run() {
echo $this->name . " is running...\n";
}
public function kill() {
echo $this->name . " is killing...\n";
}
public function sleep() {
echo $this->color . " is sleeping...\n";
$variable = "This is a Test";
}
}
?>
My little test script ;
<?php
require_once('object.php');
// Creating a bear
$daddy = new Bear;
$daddy->name = "Daddy Bear";
$daddy->age = "8";
$daddy->sex = "Male";
$daddy->color = "black";
$daddy->weight = 300;
$daddy->variable = "Testing";
// Another Bear
$mommy = new Bear;
$mommy->name = "Mommy Bear";
$mommy->age = "7";
$mommy->sex = "Female";
$mommy->color = "brown";
$mommy->weight = 310;
// ###########################
$daddy->kill();
$mommy->eat();
$mommy->sleep();
?>
Now as you can see in my first script theres a variable $variable, can you echo the data from $variable in my second test script ?
Thank you indeed, I hope there is a simple solution to this...