you should read into the concept of object orientation.
basically, a class consists of attributes (variables) and methods (functions). in a class there is no code (except var declarations) outside a method.
(simplified🙂 a php class must be instantiated and used from "outside", i.e. a "normal" script. there, you so something with your class(es) using only the methods that are offered by the class(es).
well I can't explain it here completely, but check out some articles in phpbuilder and the web in general; once you have the background knowledge, you'll like classes.