Using clases in PHP to store function
<p>I need some advise on my PHP code organisation. </p>

<p>I need classes where I can store different functions, and I need access to those classes in different parts of my project. Making an object of this classes each time is too sadly, so I've found a two ways have to solve it.</p>

<p>First is to use static methods, like</p>

<pre><code>class car {
public static $wheels_count = 4;

public static function change_wheels_count($new_count) {
    car::$wheels_count = $new_count;
} }
</code></pre>

<p>Second is to use singleton pattern:</p>

<pre><code>class Example {
// Hold an instance of the class
private static $instance;

// The singleton method
public static function singleton() 
{
    if (!isset(self::$instance)) {
        $c = __CLASS__;
        self::$instance = new $c;
    }

    return self::$instance;
}  }
</code></pre>

<p>But author of the article about singletons said, that if I have too much singletons in my code I should reconstruct it. But I need a lot of such classes.</p>

<p>Can anybody explain prons and cons of each way? Which is mostly used? Are there more beautiful ways?</p>
