Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP 5.4 ~ 5.6 での追加機能のおさらいとバージョンアップへの誘い / Re-int...

PHP 5.4 ~ 5.6 での追加機能のおさらいとバージョンアップへの誘い / Re-introduce PHP5.4~5.6 and invitation for upgrading

社内のテックミーティングの資料(公開 ver)

Yoshihide TANIGUCHI

March 16, 2017
Tweet

More Decks by Yoshihide TANIGUCHI

Other Decks in Programming

Transcript

  1. BSSBZ@DPMVNO  wd wଟ࣍ݩ഑ྻʹ͋Δ
 ಛఆͷΩʔͷ஋Λऔಘ͢Δؔ਺ $array = [ [ 'id'

    => 101, 'name' => 'Jim', 'position' => 'guitar', ], [ 'id' => 102, 'name' => 'Corey', 'position' => 'vocals', ] ]; print_r(array_column($array, 'name')); // Array // ( // [0] => Jim // [1] => Corey // )
  2. ԋࢉࢠ d wՄม௕Ҿ਺ΛԋࢉࢠͰ
 දݱͰ͖ΔΑ͏ʹͳͬͨ w͞Β͹GVOD@HFU@BSHT   function puts_nums(...$nums) {

    print_r($nums); } puts_nums(1); puts_nums(1, 2); puts_nums(1, 2, 3); // Array // ( // [0] => 1 // ) // Array // ( // [0] => 1 // [1] => 2 // ) // Array // ( // [0] => 1 // [1] => 2 // [2] => 3 // )
  3. pOBMMZΩʔϫʔυ d wUSZDBUDIϒϩοΫʹpOBMMZΩʔϫʔυ͕௥Ճ͞Εͨ try { throw new Exception('௄໾5೥'); } catch

    (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } finally { echo '͸͍'; } // => Caught exception: ௄໾5೥ // ͸͍
  4. USBJU w୯Ұܧঝͳ1)1Ͱ
 ৼΔ෣͍Λڞ༗͢Δ࢓૊Έ wྫʣը૾ΛΞοϓϩʔυͰ͖Δ
 ৼΔ෣͍Λڞ༗͢Δ trait UploadImage { function upload($imagePath)

    { //... } } class ProductController { use UploadImage; // ... } class ShopController { use UploadImage; // ... }
  5. 1)1dͰEFQSFDBUFͳػೳ ൈਮ w  w $MBTT/BNF ͳίϯετϥΫλ w ඇTUBUJDϝιουͷTUBUJDͳݺͼग़͠ w

     w FYUNDSZQUϞδϡʔϧ w  3'$ͷஈ֊  w @@BVUPMPBE   w DSFBUF@GVODUJPO   w FBDI   w ୈҾ਺ͷͳ͍QBSTF@TUS