Reputation: 157
I have a php code.
my code is like this
class 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
Upvotes: 0
Views: 219
Reputation: 417
You will have to return
a value, like this:
function connect() {
return 'Connected';
}
Upvotes: 2