PHP 8



PHP 8

公開!
名前付き引数を含む多くの新機能と最適化

名前付き引数RFC
htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
to

用途
htmlspecialchars($string, double_encode: false);

foobar.pluralize('word') # returns 'words'
foobar.pluralize('goose') # returns 'geese'
foobar.singularize('phenomena') # returns 'phenomenon'
  • は必要なパラメータだけを指定します.
  • 引数は順序独立で、自己文書化されます
    経度
  • class PostsController
    {
        /**
         * @Route("/api/posts/{id}", methods={"GET"})
         */
        public function get($id) { /* ... */ }
    }
    
    
    to
    class PostsController
    {
        #[Route("/api/posts/{id}", methods: ["GET"])]
        public function get($id) { /* ... */ }
    }
    

    Windowsでのインストール
    * Download Specify version lastest
    

    https://windows.php.net/download#php-8.0
    
    selected thread safe or not thread safe
    
    すべてのファイルをダウンロード
    この例ではララゴンを使用しています
    X:\laragon\bin\php\php-8.0.0-Win32-vs16-x86
    

    remember change this line on
    X:\laragon\etc\apache2\mod_php.conf
    
    # This file is auto-generated, so please keep it intact.
    LoadModule php8_module "x:/laragon/bin/php/php-8.0.0-Win32-vs16-x86/php8apache2_4.dll"
    PHPIniDir "x:/laragon/bin/php/php-8.0.0-Win32-vs16-x86"
    <IfModule mime_module>
        AddType application/x-httpd-php .php
    </IfModule>
    
    to
    # This file is auto-generated, so please keep it intact.
    LoadModule php_module "x:/laragon/bin/php/php-8.0.0-Win32-vs16-x86/php8apache2_4.dll"
    PHPIniDir "x:/laragon/bin/php/php-8.0.0-Win32-vs16-x86"
    <IfModule mime_module>
        AddType application/x-httpd-php .php
    </IfModule>