Framework_Db_Adapter_Abstract { ... } // Depois namespace Framework\Db\Adapater; use Framework\Db\ActiveRecord; class PostgreSQL extends Abstract { ... } $pdo = new \PDO; // classes fora do namespace $ar = new ActiveRecord; // classes do namespace ou importada
fácil [] • Servidor de testes embutido • <?= sempre ativo • Desreferência de funções como array • Acesso a métodos/atributos ao instanciar • Verificar andamento de uploads Veja mais: http://www.php.net/manual/pt_BR/migration54.new-features.php Principais novidades do PHP 5.4
protected static $_instance; protected function __construct() {} public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self; } return self::$_instance; } } class Registro extends ClasseMae { use Singleton; }
router.php PHP 5.5.0 Development Server started at Thu Jul 18 10:05:51 2013 Listening on http://localhost:8080 Document root is /Users/alanwillms/Sites Press Ctrl-C to quit. <?= sempre ativo <?php echo 'Algo'; ?> <? echo 'Algo'; ?> short_open_tag = Off <?= 'Algo'; ?>
=> 469, 'mensagem' => 'Funfou!']; } echo $this->getDados()['mensagem']; Acessar métodos e atributos ao instanciar // Antes $app = new Application($config); $app->run(); // Depois (new Application($config))->run();
$statement->fetch()) yield new self($dados); } // Milhões de registros: foreach ($modelo->findAllComGenerators() as $objeto) { echo fputcsv($handler, $objeto->attributes); }