php - how to access a variable inside the function from another class -
How can I use the variable inside a function in a square from another class
Below east .. I want to use $ asdf in another category.
For example
class abc {public function foo1 () {$ asdf = 'YEAHHHHH'; }} Class xyz {private qw; Public event foo2 () {$ this- & gt; Qw = new foo1 (); $ This- & gt; Qw- & gt; Foo1 () - & gt; Asdf; // asdf has not been found .. echo $ this- & gt; Firstly make sure the function returns the value as needed, that is:
return <$> $ asdf; Then you can reference and assign a value to a variable:
$ value = $ this-> qw- & gt; Foo1 (); Then your code will look something like this:
class abc {public function foo1 () {$ asdf = 'YehahHHH'; Return $ Asdf; }} Class xyz {private qw; Public event foo2 () {$ this- & gt; Qw = new foo1 (); $ Value = $ this- & gt; Qw- & gt; Foo1 (); Echo $ value; }}
Comments
Post a Comment