The first function you posted doesn’t return anything.
Actually I don’t know what you are trying to do. In the first function you set $this->telephone, so in second function you probably want to call $this->telephone again?
This really depends on where these two functions are located.
If you have just two functions in a file (a php file) then this is the standard:
function test()
{
some code
}
function test2()
{
some code
// run test function
test();
}
It’s that simple, now the complication is when you have them situated in classes (which is most of any framework)
Then you reference the functions by a $this-> call method. Example:
class example
{
// same thing applies with variables defined in the class
private $sample;
private function test()
{
$this->sample = 'Hello';
echo $this->sample;
}
private function test2()
{
some code
// run test function
$this->test();
}
}
Now it gets one step further in complication and this is where you’ll see it’s applied all over the framework. What if you want to call those functions within a function in another class?
Well then you have to instantiate that class? That’s why you see
$model= new Posts();
a lot where Posts is the name of the model. So you can then alter the attributes (variables) in the class by $model->attribute or run the functions by $model->function().
Now if you have to call a function of a class that’s only initiated once or is already running (true for lots of applications in Yii) then you have this format:
ClassName::ClassFunction();
or if the class instantiates another class
ClassName::NewClass()->NewClassFunction();
Hope that helps, if you’re new I highly suggest reading some OOP basics to learn the framework because it’s heavy in OOP structure.