Ver Mensaje Individual
  #10 (permalink)  
Antiguo 05/05/2010, 17:09
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: PHP 5.2 vs PHP 5.3 parámetros por defecto

Un ejemplo:
Código PHP:
Ver original
  1. final class Database extends PDO
  2. {
  3.     private static $dns = DNS;
  4.     private static $username = USERNAME;
  5.     private static $password = PASSWORD;
  6.     private static $PDO = null;
  7.    
  8.     public static function getInstance()
  9.     {
  10.         if (!(self::$PDO instanceof PDO)) {
  11.             self::$PDO = new PDO(self::$dns, self::$username, self::$password);
  12.             self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  13.         }
  14.         return self::$PDO;
  15.     }
  16. }
  17.  
  18. $db = Database::getInstance();
  19. $db->query('DESCRIBE `table`');