I want to try accessing an outside variable from a class object. how can it be possible?
my code:
<?php
$variable = "vikrant";
class greet {
public function __construct($name){
echo "hello - {$name}--{$variable}";
}
}
$message = new greet("vijay");
?>
this thing doesn't work. but I need to know how to achieve it.