0

some people keep telling me that globals in a function aren't a really good idea. I am not THAT good in PHP5 or OOP but i'm still learning. Now, my question to you is:

Is there a better way than doing this? :

<?php 
class Name {
     final public function Example() {
          global $db;
          $db->query("SELECT * FROM users");
          ....
     }
}
?>

Thanks!

DC20-4
  • 1

0 Answers0