Re: class, 2 functions, arrays, problem.
| From: | Faisal Nasim | Date: | Thu, 13 Apr 2000 06:20:49 +0000 |
| Subject: | Re: class, 2 functions, arrays, problem. | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-17866@lists.php.net to get a copy of this message | ||
$d and $f are not global!
You could:
class blah
{
# the declarations are not necessary, but comes quite
# handy when you need to know which variables
# are shared in the class
var $d;
var $f;
function blah ( $var = "default" )
{
# If $d = $var, then $d is destroyed when function ends
$this -> d = $var;
}
function show ()
{
return $this -> d;
}
}
$d and $f can be scalars, arrays, objects or hashes.
$etc = new blah; # or $etc = new blah ( "VALUE" )
print $etc -> show();
Enjoy!
Faisal
: <?php
:
: class filez {
:
: function filez($folder = ".") {
<cut>
: }
:
: function showit() {
: global $d,$f;
<cut>
: $w = new filez();
: $w -> showit();