I don’t know how to get access to the drupal variable in the external .php file.
In the module i assign the variable in order to use it in the template:
$variables['teams'] = $output;
In the template file i can access it by:
<?php foreach ($teams as $row) { ?>
<?php print $row['team_name']?>
<?php } ?>
But I’d like to access this variable from another external php file. How can i do it?
You should give us some more information about where you are planning on using that variable.
If you are planning on using the variable in a template file, $variables should be fine, otherwise you could store it somewhere or set is as a global. If you want to use it from another module, you should make sure that the hook that sets the variable has run before the hook where you plan on using the variable. If they are the same hook (i.e. nodeapi) make sure the weight of the second module is higher.
If you need to use the variable outside the Drupal bootstrap, store it. You can use the drupal_cache_set or variable_set.