Is it possible to get from another file, a variable inside a class's function?

I use include to get the other file.

I'm not sure how I would pull that variable.

    //FunDbConnect.php

    <?php

    class FunDbConnect {

    function connect() {
  
    global $delete1;
            $delete1==42;
    
    return 1;
    
    
        }

    }
            ?>




    //index.php

    <?php
     define('MAINDIR',dirname(__FILE__) . '/');
    require_once(MAINDIR . 'FunDbConnect.php');

     $db= new FunDBConnect();

 $trial1 = FunDbConnect::$delete1;
 echo $trial1;


            ?>

Posted Aug 29, 2016, 11:58 PM UTC · edited

16
Loading comments…