How to pass parameters from one function to another?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
10 views
Good day! You have the following class:
class newClass { public $url; public function __construct($url) { $this->url = $url; } function firstFunc() { $param1 = $this->url; return $param1; } function secondFunc() { } }


Please tell me how to pass param1 in secondFunc()?
And throw in my book, which is dedicated to working with classes.
Thank you very much!
by | 10 views

1 Answer

0 like 0 dislike
What is the meaning to transfer $param1 function secondFunc () if $param1 and $url is the same.

It turns out in function secondFunc() is already available.

class newClass { public $url; public function __construct($url) { $this->url = $url; } function firstFunc() { $param1 = $this->url; return $param1; } function secondFunc() { $param1 = $this->url; // $this->url constructor already sets the value. And the value initially passed to the constructor. } }
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
35,405 users