try the following code :
function __construct() {
parent::__construct();
$green ="green";
}
public function green(){
echo"this is $green";
}
Place the $green variable in constructor.
More Related Contents:
- Symfony 3, Guard & Handlers
- Using PHP data in MySQL [closed]
- PHP loop blocking the rest of the code to execute [closed]
- How to display errors for my MySQLi query? [duplicate]
- PHP write file from input to txt
- $_SERVER[‘HTTP_REFERER’] missing
- Configure WAMP server to send email
- What exactly are late static bindings in PHP?
- Create or write/append in text file
- Round up to nearest multiple of five in PHP
- How do I use arrays in cURL POST requests
- Send multiple checkbox data to PHP via jQuery ajax()
- What exactly is PATH_INFO in PHP?
- What is the best way to check if a URL exists in PHP?
- Why does crypt/blowfish generate the same hash with two different salts?
- Search and replace multiple values with multiple/different values in PHP5?
- in MVC, where do you draw the line between a controller and model? [closed]
- keeping url parameters during pagination
- Generating a random hex color code with PHP
- How can I set a cookie and then redirect in PHP?
- for loop vs while loop vs foreach loop PHP
- How to find a reason when mkdir fails from PHP?
- Get file content via PHP cURL [closed]
- Can I serve MP3 files with PHP?
- Troubleshooting “The use statement with non-compound name … has no effect”
- Can anyone give me an example for PHP’s CURLFile class?
- How to clear php’s gettext cache without restart Apache nor change domain?
- Create PHP array from MySQL column
- XPath query with PHP
- PDO Exception Questions – How to Catch Them