exit a method and store a variable
Posted: Wed Mar 16, 2011 8:06 pm
If this can't be done then can someone say so please. in the example below, is there a way to get the variable of $firstn when the method setData exits? for example, I called method setData with the $firstn parameter. now that the method setData has exited, I would like to store the $firstn variable with the variable that setData exited with. Is this possible?
Code: Select all
<?
class Customer {
var $firstname;
function setData($firstname1) {
$firstname = $this->firstname1;
echo $this->firstname;
}
}
$test = new Customer;
$test -> firstname = "test";
$test -> setData($firstn);
?>