I have a php code. my code is like thisclass Connection {
function connect(){
$link = 'Connected';
}
}
$con = new Connection();
$con -> connect();
echo $con->link;//connected
here i want to echo the variable but it is not getting Help me
You will have to return
a value, like this:
function connect() {
return 'Connected';
}