PHP how can i use a class method in another class method?
<p>security.php
    

<pre><code>class Security {

    public function sanitize($data) {
        return mysql_real_escape_string($data);
    }
}
?&gt;
</code></pre>

<p>users.php</p>

<pre><code>&lt;?php


class User {

    private $db;

    public function __construct() {
        $this-&gt;db = new Connection();
        $this-&gt;db = $this-&gt;db-&gt;dbConnect();
    }

    public function userExists($username) {
        $username = sanitize($username);
        $st = $this-&gt;db-&gt;prepare("SELECT * FROM `users` WHERE `username`=? ");
        $st-&gt;bindParam(1, $username);
        $st-&gt;execute();

        if ($st-&gt;rowCount() == 1) {
                echo "User exists";
            } else {
                echo 'Incorrect username or password lad';
            }
    }
}

?&gt;
</code></pre>

<p>in my user exists method i want to use sanitize method but im am unsure the correct way to do this in oop.
both class are on a different file. any help appreciated.</p>
