Support the ongoing development of Laravel.io →
Input Views
Last updated 2 months ago.
0

Not sure I understand what you are trying to do, but in a class you could do

class myClass{

    private $var;

    public function funcA(){
        $this->var = "Test"; 
        return $this->var; 
    }
    public function funcB(){
        //$var ; 
        echo "Yeah I reused " . $this->var; 
    }

}
1
Solution selected by @omaromp2

When I try to do that it returned null. :(

Last updated 5 years ago.
0

Well I ended up reusing the var via compact. Not sure it was what I was looking for but it worked.

0

Sign in to participate in this thread!

Cloudways

Your banner here too?

omaromp2 omaromp2 omaromp2 Joined 21 Jul 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.