Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Singleton
- * @author David Hopkins (semlabs.co.uk)
- * @version 0.1
- */
- class Sing
- {
- function &get( $name, $args = array() )
- {
- static $instance;
- if( !isset( $instance ) )
- $instance = array();
- if( !isset( $instance[$name] ) )
- {
- $instance[$name] = new ReflectionClass( $name );
- $instance[$name] = $instance[$name]->newInstanceArgs( $args );
- }
- return $instance[$name];
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement