title: call another class's function inside a class
body: <p>i have 2 classes  </p>
  
  <ol>
  <li>for DB  </li>
  <li>for language  </li>
  </ol>
  
  <p>i want to use my language things in the DB
  so it outputs the result</p>
  
  <p>ex :</p>
  
  <pre><code>class db_control{
  
          var $db_connection, $lang_var;
          //create the function for the connection
          function db_connect(){
              //define some variables
              global $db_host, $db_username, $db_password, $db_name, $lang_var;
              $this-&gt;db_connection = mysql_connect("$db_host","$db_username","$db_password")or die("can't connect to server with these informations");
              //checl that the connection is established
              if($this-&gt;db_connection){
                  echo $lang_vars-&gt;getvar("$langvals[lang_con_est]");
              }
  </code></pre>
  
  <p>but this</p>
  
  <pre><code>$lang_vars-&gt;getvar("$langvals[lang_con_est]");
  </code></pre>
  
  <p>doesn't work
  i mean it outputs many problems
  and am sure my problem is that i didn't define my variables and classes correctly</p>
  
  <p>P.S : the language class is in file called language.php and this part is in DB.MySQL.php</p>
  
  <p>EDIT : 
  this is the language class</p>
  
  <pre><code>class lang_vars{
      public static function getvar($variable){
          return $variable;
      }
  }
  </code></pre>
  
  <p>i want the DB class to display text from the language class
  thats why i used </p>
  
  <pre><code> echo $lang_vars-&gt;getvar("$langvals[lang_con_est]");
  </code></pre>
  
  <p>but it doesn't work
  cuz when i declare the language class
  $lang_vars = new lang_vars;
  inside the db_control it shows error unexpected T_something expected T_Function
  and when i declare it outside nothing up
  hope i made things more clear now</p>