SlideShare ist ein Scribd-Unternehmen logo
1 von 81
Downloaden Sie, um offline zu lesen
PHP5.4

@tanakahisateru
ABOUT ME

•              (               )

• @tanakahisateru

• https://github.com/tanakahisateru

• Firebug, FireCookie, jEdit

• ...and   Pinoco
関西PHP勉強会 php5.4つまみぐい
•   PHP5.4

•   Array Short Syntax

•   Built-in Server

•   Trait

•   Closure

•
:
PHP5.4


Graham     ( @predominant )
                                  :)
     http://tipshare.info/view/
   4ec326d04b2122ce49000000
PHP5.4
PHP 5.4 RC1 (2011/11/11)

• http://www.php.net/archive/2011.php#id2011-11-11-1
PHP
          PHP 5.4
    http://www.1x1.jp/blog/
            2011/06/
try_new_php_without_update
     _current_version.html

            configure      make
•   Windows

    •   http://windows.php.net/qa/



•   Mac

    •   XCode + MacPorts or Homebrew

•   Linux

    •
% curl -o php-5.4.0RC1.tar.gz http://downloads.php.net/stas/
php-5.4.0RC1.tar.gz
% tar xzf php-5.4.0RC1.tar.gz
% cd php-5.4.0RC1
% ./configure 
--prefix=/opt/local/php/5.4 
--bindir=/opt/local/bin 
--with-config-file-path=/opt/local/php/5.4/etc 
--with-config-file-scan-dir=/opt/local/php/5.4/var/db 
--mandir=/opt/local/php/5.4/share/man 
--infodir=/opt/local/php/5.4/share/info 
--program-suffix=-5.4 
--with-apxs2=/opt/local/apache2/bin/apxs 
(      https://gist.github.com/1344162           )
% make
(make install)
sapi/cli/php


      configure


         PHP
% sapi/cli/php -v
PHP 5.4.0RC1 (cli) (built: Nov 23 2011 23:08:40)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend
Technologies




% sapi/cli/php -a
Interactive shell

php >
php > echo “Hello Worldn”;
Hello World

php > print_r(array_map(function($x){ return $x * 2; },
range(0,9)));
Array
(
    [0] => 0
    [1] => 2
    [2] => 4
    [3] => 6
    [4] => 8
    [5] => 10
    [6] => 12
    [7] => 14
    [8] => 16
    [9] => 18
)                                   :
php > echo 0xff == 0b11111111, "n";
1
ARRAY SHORT SYNTAX
array(1, 2, 3)


[1, 2, 3]
array(‘a’=>1, ‘b’=>2)


[‘a’=>1, ‘b’=>2]
@rsky




https://wiki.php.net/rfc/
 shortsyntaxforarrays
var $belongsTo = array(
! 'User'
);
var $hasMany = array(
    'Photo' => array(
        'order' => 'number'
    )
);

var $belongsTo = [
! 'User'
];
var $hasMany = [
    'Photo' => [
        'order' => 'number'
    ]
];
$this->render('list', array(
  'posts' => Post::find(array(
     'limit' => Config::get('postsPerPage',
       array('context'=>'blog', 'default'=>10)),
  ))
));

                                              ?
$this->render('list', [
  'posts' => Post::find([
     'limit' => Config::get('postsPerPage',
       ['context'=>'blog', 'default'=>10]),
  ])
]);
関西PHP勉強会 php5.4つまみぐい
$this->render('list', array(
  'posts' => Post::find(array(
     'limit' => Config::get('postsPerPage',
       array('context'=>'blog', 'default'=>10)),
  ))
));




$this->render('list', [
  'posts' => Post::find([
     'limit' => Config::get('postsPerPage',
       ['context'=>'blog', 'default'=>10]),
  ])
]);
$this->render('list', array(
  'posts' => Post::find(array(
     'limit' => Config::get('postsPerPage',
       array('context'=>'blog', 'default'=>10)),
  ))
));




$this->render('list', [
  'posts' => Post::find([
     'limit' => Config::get('postsPerPage',
       ['context'=>'blog', 'default'=>10]),
  ])
]);


                               Array
$this->render('list', array(
  'posts' => Post::find(array(
     'limit' => Config::get('postsPerPage',
       array('context'=>'blog', 'default'=>10)),
  ))
));




$this->render('list', [
  'posts' => Post::find([
     'limit' => Config::get('postsPerPage',
       ['context'=>'blog', 'default'=>10]),
  ])
]);




          [ ... ]
ARRAY SHORT SYNTAX

•                  →

•


• PHP


•          Array
ARRAY SHORT SYNTAX


•   PHP   array       YAML



•   PHP
BUILT-IN SERVER
PHP
Web
% sapi/cli/php -S localhost:8080
•   Javascript Flash     file://       API
        →                    PHP5.4

•           Apache



•                      PHP
.htaccess   mod_rewrite
PHP
% sapi/cli/php -S localhost:8080 builtin-server.php
list($path, $param) = array_merge(
     preg_split('/?/', $_SERVER['REQUEST_URI'], 2), ['', '']
);
if($path != '/' && (file_exists('app/webroot' . $path)))
{
     header(sprintf('Location: http://%s/app/webroot%s',
         $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])); exit;
}
else if($path != '/' && (file_exists('./' . $path)))
{
     return false;
}
else
{
     $_SERVER['PATH_INFO'] = $path;
     require 'app/webroot/index.php';
}
% ~/php54/php-5.4.0RC1/sapi/cli/php -S localhost:8080
builtin-server.php
関西PHP勉強会 php5.4つまみぐい
PHP 5.4.0RC1 Development Server started at Thu Nov 24 02:11:37 2011
Listening on localhost:8080
Document root is /Users/tanakahisateru/Sites/cakephp2
Press Ctrl-C to quit.
[Thu Nov 24 02:11:42 2011] ::1:63556 [200]: /app/webroot/css/cake.generic.css
[Thu Nov 24 02:11:42 2011] ::1:63557 [200]: /app/webroot/img/cake.power.gif
[Thu Nov 24 02:11:42 2011] ::1:63558 [200]: /app/webroot/img/cake.icon.png
[Thu Nov 24 02:11:42 2011] ::1:63564 [200]: /app/webroot/favicon.ico
MacPorts       MySQL
                      php.ini
 % ~/php54/php-5.4.0RC1/ sapi/cli/php -c ~/php54/
 php-5.4.0RC1/ -S localhost:8080 builtin-server.php



              ~/php54/php-5.4.0RC1/php.ini
[Pdo_mysql]
pdo_mysql.default_socket=/opt/local/var/run/mysql5/mysqld.sock



          MySQL
BUILT-IN SERVER

•                                           URL
                              OK

• Apache


•                 PHP5.3
                                   Apache
    mod_php          PHP5.4
TRAIT
NO.1
TRAIT

•


•   Ruby         mixin

•          PHP               (instanceof   )



•
関西PHP勉強会 php5.4つまみぐい
1
         INCLUDE / REQUIRE

•


• HTML


•                          /
2

•




•




•   class AppModel extends Model
    class GuestUser extends AppModel
    class AdminUser extends AppModel
                                User
class AppModel extends Model {
}

class GuestUser extends AppModel {
    public function getDisplayLabel() {
        ...;
    }
}                                           !!
class AdminUser extends AppModel {
    public function getDisplayLabel() {
        ...;
    }
    public function getAdminRioleType() {
        ...;
    }
}
class AppModel extends Model {
    public function getDisplayLabel() {
        ...;
    }
}

class GuestUser extends AppModel {
}

class AdminUser extends AppModel {
    public function getAdminRioleType() {
        ...;
    }
}
class AppModel extends Model {
    public function getDisplayLabel() {
        return $this->username . “   ”;
    }
}

class GuestUser extends AppModel {
}

class AdminUser extends AppModel {
    public function getAdminRoleType() {
        ...;
    }
}

class Comment extends AppModel {
    // username                      ←
}
UserModel.inc
    public function getDisplayLabel() {
        return $this->username . “   ”;
    }

class GuestUser extends AppModel {
    require ‘UserModel.inc’;
}

class AdminUser extends AppModel {
    require ‘UserModel.inc’;
    public function getAdminRoleType() {
        ...;
    }
}

class Comment extends AppModel {
}                                                ...
        require             =              orz
trait UserModel {
    public function getDisplayLabel() {
        return $this->username . “   ”;
    }
}

class GuestUser extends AppModel {
    use UserModel;
}

class AdminUser extends AppModel {
    use UserModel;
    public function getAdminRoleType() {
        ...;
    }
}

class Comment extends AppModel {
}
関西PHP勉強会 php5.4つまみぐい
trait PersistentModel {
    public function save() {
    }                                            =
}

abstract class User {                            =
    public function getDisplayLabel() {
        return $this->username . “   ”;
    }
}

class GuestUser extends User inplements Persistence {
    use PersistentModel;
}

class AdminUser extends User inplements Persistence {
    use PersistentModel;
    public function getAdminRoleType() {
        ...;
    }
}
PHP5.4
O/R
関西PHP勉強会 php5.4つまみぐい
CLOSURE
関西PHP勉強会 php5.4つまみぐい
CALLABLE
call_user_func
php   > $fun = 'intval';
php   > echo call_user_func($fun, "0001abc"), "n";
1
php   > echo is_callable($fun), "n";
1
php   > echo is_string($fun), "n";
1


php > echo $fun("0001abc"), "n";
1
call_user_func                             array
php >   $obj = new Exception('hoge');
php >   $msg = [$obj, 'getMessage'];
php >   echo call_user_func($msg), "n";
hoge
php >   echo is_callable($msg), "n";
1
php >   echo is_array($msg), "n";
1


php > echo $msg(), "n";
hoge
php > echo $closure(), "n";   //




 string array
                               ↓
 is_callable
                                    Array
$THIS IN CLOSURE
PHP5.3
<?php
class CounterFactory {
    function __construct($init) {
        $this->init = $init;
    }
    function createCounter() {
        $c = 0;
        return function() use(&$c) {
            return $this->init + ($c++);
        };
    }
}
$fact = new CounterFactory(100);
$c1 = $fact->createCounter();
$c2 = $fact->createCounter();
echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n";
echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n";
echo "c2:", $c2(), "n"; echo "c1:", $c1(), "n";
PHP5.3
<?php
class CounterFactory {
    function __construct($init) {
        $this->init = $init;
    }
    function createCounter() {
        $c = 0;
        $self = $this;
        return function() use($self, &$c) {
            return $self->init + ($c++);
        };
    }
}
$fact = new CounterFactory(100);
$c1 = $fact->createCounter();
$c2 = $fact->createCounter();
echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n";
echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n";
echo "c2:", $c2(), "n"; echo "c1:", $c1(), "n";
self → Python
PHP5.4                               OK!
<?php
class CounterFactory {
    function __construct($init) {
        $this->init = $init;
    }
    function createCounter() {
        $c = 0;
        return function() use(&$c) {
            return $this->init + ($c++);
        };
    }
}
$fact = new CounterFactory(100);
$c1 = $fact->createCounter();
$c2 = $fact->createCounter();
echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n";
echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n";
echo "c2:", $c2(), "n"; echo "c1:", $c1(), "n";
<?php
class CounterFactory {
    function __construct($init) {
        $this->init = $init;
    }
    function createCounter() {
        $c = 0;
        return function() use(&$c) {
            return $this->init + ($c++);
        };
    }
}
$fact = new CounterFactory(100);
$c1 = $fact->createCounter();
$c2 = $fact->createCounter();
echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n";
echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n";
echo "c2:", $c2(), "n"; echo "c1:", $c1(), "n";

c1:100   <--   init=100   +   c=0
c1:101   <--   init=100   +   c=1
c2:100   <--   init=100   +   c=0
c2:101   <--   init=100   +   c=1
c2:102   <--   init=100   +   c=2
c1:102   <--   init=100   +   c=2
Javascript
$THIS
<?php
class CounterFactory {
    function __construct($init) {
        $this->init = $init;
    }
    function createCounter() {
        $c = 0;
        return function() use(&$c) {
            return $this->init + ($c++);
        };
    }
}
$fact = new CounterFactory(100);
$c1 = $fact->createCounter();
echo "c1:", $c1(), "n";
echo "c1:", $c1(), "n";
$c1 = $c1->bindTo(new CounterFactory(1000));
echo "c1:", $c1(), "n";
<?php
class CounterFactory {
    function __construct($init) {
        $this->init = $init;
    }
    function createCounter() {
        $c = 0;
        return function() use(&$c) {
            return $this->init + ($c++);
        };
    }
}
$fact = new CounterFactory(100);
$c1 = $fact->createCounter();
echo "c1:", $c1(), "n";
echo "c1:", $c1(), "n";
$c1 = $c1->bindTo(new CounterFactory(1000));
echo "c1:", $c1(), "n";


c1:100 <-- init=100 + c=0
c1:101 <-- init=100 + c=1
c1:1002 <-- init=1000 + c=2
CLOSURE

•   PHP5.4                       create_function

•   Javascript           this

•                    $this                $this



•

    →            PHP5.3 $self               bindTo        PHP5.4
                                                  $this
<?php                             <?php
class Hoge {                      class Hoge {
  function __construct($init) {     function __construct($init) {
    $this->init = $init;              $this->init = $init;
  }                                 }
  function x($n) {                  function x($n) {
    $tmp = [];                        return array_map(
    for($i=0; $i<$n; $i++) {             function() {
      $tmp[] = $this->init;                return $this->init;
    }                                    }, range(0,$n-1)
    return $tmp;                      );
  }                                 }
}                                 }

print_r((new Hoge(100))->x(3));   print_r((new Hoge(100))->x(3));
関西PHP勉強会 php5.4つまみぐい
• new


•       array
関西PHP勉強会 php5.4つまみぐい
PHP5.3
                PHP5.4                  OK


echo (new Exception("hoge"))->getMessage(), "n";
PHP5.3
                PHP5.4       OK


echo range(0, 9)[5], “n”;
PHP5.4.0RC1


php > echo (array(1, 2, 3))[0], "n";
Parse error: syntax error, unexpected '[', expecting ',' or ';'
in php shell code on line 1

php > echo (function($x){ return $x * 2; })(10), "n";
Parse error: syntax error, unexpected '(', expecting ',' or ';'
in php shell code on line 1
関西PHP勉強会 php5.4つまみぐい
<?=


<?=
PHP5.4

• PHP5.3

           5.2

 •


 • Phar

• PHP5.4
関西PHP勉強会 php5.4つまみぐい
PHP5.4

Weitere ähnliche Inhalte

Was ist angesagt?

Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @SilexJeen Lee
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsMark Baker
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojobpmedley
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsMark Baker
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Shinya Ohyanagi
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsMark Baker
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)julien pauli
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101hendrikvb
 
Cli the other SAPI confoo11
Cli the other SAPI confoo11Cli the other SAPI confoo11
Cli the other SAPI confoo11Combell NV
 
Php tips-and-tricks4128
Php tips-and-tricks4128Php tips-and-tricks4128
Php tips-and-tricks4128PrinceGuru MS
 
CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11Combell NV
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsMark Baker
 
RESTful API 제대로 만들기
RESTful API 제대로 만들기RESTful API 제대로 만들기
RESTful API 제대로 만들기Juwon Kim
 
Intro to php
Intro to phpIntro to php
Intro to phpSp Singh
 
Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18Lar21
 

Was ist angesagt? (20)

Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @Silex
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP Generators
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP Generators
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensions
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
 
Cli the other SAPI confoo11
Cli the other SAPI confoo11Cli the other SAPI confoo11
Cli the other SAPI confoo11
 
Php tips-and-tricks4128
Php tips-and-tricks4128Php tips-and-tricks4128
Php tips-and-tricks4128
 
CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
 
Php functions
Php functionsPhp functions
Php functions
 
RESTful API 제대로 만들기
RESTful API 제대로 만들기RESTful API 제대로 만들기
RESTful API 제대로 만들기
 
Intro to PHP
Intro to PHPIntro to PHP
Intro to PHP
 
PHP7 Presentation
PHP7 PresentationPHP7 Presentation
PHP7 Presentation
 
Intro to php
Intro to phpIntro to php
Intro to php
 
Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18
 
Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLID
 

Andere mochten auch

CakePHP最新情報 PHPカンファレンス関西2012
CakePHP最新情報 PHPカンファレンス関西2012CakePHP最新情報 PHPカンファレンス関西2012
CakePHP最新情報 PHPカンファレンス関西2012ichikaway
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentTakayuki Miyauchi
 
オープンソース & オープンデータ
オープンソース & オープンデータオープンソース & オープンデータ
オープンソース & オープンデータTakayuki Miyauchi
 
FuelPHPをさわってみて
FuelPHPをさわってみてFuelPHPをさわってみて
FuelPHPをさわってみてSotaro Omura
 
WordPress開発の最新事情
WordPress開発の最新事情WordPress開発の最新事情
WordPress開発の最新事情Takayuki Miyauchi
 
え?まだMAMPで消耗してんの?
え?まだMAMPで消耗してんの?え?まだMAMPで消耗してんの?
え?まだMAMPで消耗してんの?Takayuki Miyauchi
 
オープンソースによるイノベーションの継続
オープンソースによるイノベーションの継続オープンソースによるイノベーションの継続
オープンソースによるイノベーションの継続Takayuki Miyauchi
 

Andere mochten auch (12)

PHP-Ninjaの裏側
PHP-Ninjaの裏側PHP-Ninjaの裏側
PHP-Ninjaの裏側
 
CakePHP最新情報 PHPカンファレンス関西2012
CakePHP最新情報 PHPカンファレンス関西2012CakePHP最新情報 PHPカンファレンス関西2012
CakePHP最新情報 PHPカンファレンス関西2012
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environment
 
オープンソース & オープンデータ
オープンソース & オープンデータオープンソース & オープンデータ
オープンソース & オープンデータ
 
FuelPHPをさわってみて
FuelPHPをさわってみてFuelPHPをさわってみて
FuelPHPをさわってみて
 
WordPress開発の最新事情
WordPress開発の最新事情WordPress開発の最新事情
WordPress開発の最新事情
 
え?まだMAMPで消耗してんの?
え?まだMAMPで消耗してんの?え?まだMAMPで消耗してんの?
え?まだMAMPで消耗してんの?
 
あらためてPHP5.3
あらためてPHP5.3あらためてPHP5.3
あらためてPHP5.3
 
Cybozu Kintone x WordPress
Cybozu Kintone x WordPressCybozu Kintone x WordPress
Cybozu Kintone x WordPress
 
I love Automation
I love AutomationI love Automation
I love Automation
 
オープンソースによるイノベーションの継続
オープンソースによるイノベーションの継続オープンソースによるイノベーションの継続
オープンソースによるイノベーションの継続
 
WordPress on HHVM + Hack
WordPress on HHVM + HackWordPress on HHVM + Hack
WordPress on HHVM + Hack
 

Ähnlich wie 関西PHP勉強会 php5.4つまみぐい

What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207patter
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkDirk Haun
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)arcware
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applicationschartjes
 
Apostrophe
ApostropheApostrophe
Apostrophetompunk
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Michelangelo van Dam
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormMichelangelo van Dam
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsMichael Peacock
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Michelangelo van Dam
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Michelangelo van Dam
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2Elizabeth Smith
 
Phpspec tips&amp;tricks
Phpspec tips&amp;tricksPhpspec tips&amp;tricks
Phpspec tips&amp;tricksFilip Golonka
 

Ähnlich wie 関西PHP勉強会 php5.4つまみぐい (20)

What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
Fatc
FatcFatc
Fatc
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
Apostrophe
ApostropheApostrophe
Apostrophe
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new with PHP7
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2
 
Phpspec tips&amp;tricks
Phpspec tips&amp;tricksPhpspec tips&amp;tricks
Phpspec tips&amp;tricks
 

Mehr von Hisateru Tanaka

HTMLに学ぶ夫婦円満のコツ
HTMLに学ぶ夫婦円満のコツHTMLに学ぶ夫婦円満のコツ
HTMLに学ぶ夫婦円満のコツHisateru Tanaka
 
とある事業の脱レガシー
とある事業の脱レガシーとある事業の脱レガシー
とある事業の脱レガシーHisateru Tanaka
 
Yii Framework 2.0 いま求められるRAD標準とは #phpkansai
Yii Framework 2.0 いま求められるRAD標準とは #phpkansaiYii Framework 2.0 いま求められるRAD標準とは #phpkansai
Yii Framework 2.0 いま求められるRAD標準とは #phpkansaiHisateru Tanaka
 
第21回関西PHP勉強会 ReactPHPは もっと流行って欲しい #phpkansai
第21回関西PHP勉強会 ReactPHPは もっと流行って欲しい #phpkansai第21回関西PHP勉強会 ReactPHPは もっと流行って欲しい #phpkansai
第21回関西PHP勉強会 ReactPHPは もっと流行って欲しい #phpkansaiHisateru Tanaka
 
ダイクストラの構造化 プログラミングに学ぶ 結婚生活
ダイクストラの構造化 プログラミングに学ぶ 結婚生活ダイクストラの構造化 プログラミングに学ぶ 結婚生活
ダイクストラの構造化 プログラミングに学ぶ 結婚生活Hisateru Tanaka
 
PHPカンファレンス関西2014 Yii Framework 2.0 遅れてきた5番目のフレームワーク
PHPカンファレンス関西2014 Yii Framework 2.0 遅れてきた5番目のフレームワークPHPカンファレンス関西2014 Yii Framework 2.0 遅れてきた5番目のフレームワーク
PHPカンファレンス関西2014 Yii Framework 2.0 遅れてきた5番目のフレームワークHisateru Tanaka
 
Grunt front-osaka-1-lt-tanaka
Grunt front-osaka-1-lt-tanakaGrunt front-osaka-1-lt-tanaka
Grunt front-osaka-1-lt-tanakaHisateru Tanaka
 
Phpstormちょっといい話
Phpstormちょっといい話Phpstormちょっといい話
Phpstormちょっといい話Hisateru Tanaka
 
#phpmatsuri LT大会システムの中身
#phpmatsuri LT大会システムの中身#phpmatsuri LT大会システムの中身
#phpmatsuri LT大会システムの中身Hisateru Tanaka
 
&& || and or まぜるな危険
&& || and or まぜるな危険&& || and or まぜるな危険
&& || and or まぜるな危険Hisateru Tanaka
 
Phpcon kansani-2013-pinoco
Phpcon kansani-2013-pinocoPhpcon kansani-2013-pinoco
Phpcon kansani-2013-pinocoHisateru Tanaka
 
はじめてのGit #gitkyoto
はじめてのGit #gitkyotoはじめてのGit #gitkyoto
はじめてのGit #gitkyotoHisateru Tanaka
 
PhpStormを使おう --高槻からは快速急行が早くなります #jbugj
PhpStormを使おう --高槻からは快速急行が早くなります #jbugjPhpStormを使おう --高槻からは快速急行が早くなります #jbugj
PhpStormを使おう --高槻からは快速急行が早くなります #jbugjHisateru Tanaka
 
いまどきのYiiフレームワーク
いまどきのYiiフレームワークいまどきのYiiフレームワーク
いまどきのYiiフレームワークHisateru Tanaka
 
Word pressのテーマは firephpでハックすれば 良かったのか
Word pressのテーマは firephpでハックすれば 良かったのかWord pressのテーマは firephpでハックすれば 良かったのか
Word pressのテーマは firephpでハックすれば 良かったのかHisateru Tanaka
 
関西Php勉強会のlimeの話
関西Php勉強会のlimeの話関西Php勉強会のlimeの話
関西Php勉強会のlimeの話Hisateru Tanaka
 
Pinoco phptal-phpcon-kansai
Pinoco phptal-phpcon-kansaiPinoco phptal-phpcon-kansai
Pinoco phptal-phpcon-kansaiHisateru Tanaka
 
Yiiフレームワークを使ってみた
Yiiフレームワークを使ってみたYiiフレームワークを使ってみた
Yiiフレームワークを使ってみたHisateru Tanaka
 

Mehr von Hisateru Tanaka (19)

HTMLに学ぶ夫婦円満のコツ
HTMLに学ぶ夫婦円満のコツHTMLに学ぶ夫婦円満のコツ
HTMLに学ぶ夫婦円満のコツ
 
とある事業の脱レガシー
とある事業の脱レガシーとある事業の脱レガシー
とある事業の脱レガシー
 
Yii Framework 2.0 いま求められるRAD標準とは #phpkansai
Yii Framework 2.0 いま求められるRAD標準とは #phpkansaiYii Framework 2.0 いま求められるRAD標準とは #phpkansai
Yii Framework 2.0 いま求められるRAD標準とは #phpkansai
 
第21回関西PHP勉強会 ReactPHPは もっと流行って欲しい #phpkansai
第21回関西PHP勉強会 ReactPHPは もっと流行って欲しい #phpkansai第21回関西PHP勉強会 ReactPHPは もっと流行って欲しい #phpkansai
第21回関西PHP勉強会 ReactPHPは もっと流行って欲しい #phpkansai
 
ダイクストラの構造化 プログラミングに学ぶ 結婚生活
ダイクストラの構造化 プログラミングに学ぶ 結婚生活ダイクストラの構造化 プログラミングに学ぶ 結婚生活
ダイクストラの構造化 プログラミングに学ぶ 結婚生活
 
PHPカンファレンス関西2014 Yii Framework 2.0 遅れてきた5番目のフレームワーク
PHPカンファレンス関西2014 Yii Framework 2.0 遅れてきた5番目のフレームワークPHPカンファレンス関西2014 Yii Framework 2.0 遅れてきた5番目のフレームワーク
PHPカンファレンス関西2014 Yii Framework 2.0 遅れてきた5番目のフレームワーク
 
Grunt front-osaka-1-lt-tanaka
Grunt front-osaka-1-lt-tanakaGrunt front-osaka-1-lt-tanaka
Grunt front-osaka-1-lt-tanaka
 
Phpstormちょっといい話
Phpstormちょっといい話Phpstormちょっといい話
Phpstormちょっといい話
 
#phpmatsuri LT大会システムの中身
#phpmatsuri LT大会システムの中身#phpmatsuri LT大会システムの中身
#phpmatsuri LT大会システムの中身
 
&& || and or まぜるな危険
&& || and or まぜるな危険&& || and or まぜるな危険
&& || and or まぜるな危険
 
Phpcon kansani-2013-pinoco
Phpcon kansani-2013-pinocoPhpcon kansani-2013-pinoco
Phpcon kansani-2013-pinoco
 
はじめてのGit #gitkyoto
はじめてのGit #gitkyotoはじめてのGit #gitkyoto
はじめてのGit #gitkyoto
 
PhpStormを使おう --高槻からは快速急行が早くなります #jbugj
PhpStormを使おう --高槻からは快速急行が早くなります #jbugjPhpStormを使おう --高槻からは快速急行が早くなります #jbugj
PhpStormを使おう --高槻からは快速急行が早くなります #jbugj
 
いまどきのYiiフレームワーク
いまどきのYiiフレームワークいまどきのYiiフレームワーク
いまどきのYiiフレームワーク
 
Kphpug beginners-2
Kphpug beginners-2Kphpug beginners-2
Kphpug beginners-2
 
Word pressのテーマは firephpでハックすれば 良かったのか
Word pressのテーマは firephpでハックすれば 良かったのかWord pressのテーマは firephpでハックすれば 良かったのか
Word pressのテーマは firephpでハックすれば 良かったのか
 
関西Php勉強会のlimeの話
関西Php勉強会のlimeの話関西Php勉強会のlimeの話
関西Php勉強会のlimeの話
 
Pinoco phptal-phpcon-kansai
Pinoco phptal-phpcon-kansaiPinoco phptal-phpcon-kansai
Pinoco phptal-phpcon-kansai
 
Yiiフレームワークを使ってみた
Yiiフレームワークを使ってみたYiiフレームワークを使ってみた
Yiiフレームワークを使ってみた
 

Kürzlich hochgeladen

COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 

Kürzlich hochgeladen (20)

COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 

関西PHP勉強会 php5.4つまみぐい

  • 2. ABOUT ME • ( ) • @tanakahisateru • https://github.com/tanakahisateru • Firebug, FireCookie, jEdit • ...and Pinoco
  • 4. PHP5.4 • Array Short Syntax • Built-in Server • Trait • Closure •
  • 5. :
  • 6. PHP5.4 Graham ( @predominant ) :) http://tipshare.info/view/ 4ec326d04b2122ce49000000
  • 8. PHP 5.4 RC1 (2011/11/11) • http://www.php.net/archive/2011.php#id2011-11-11-1
  • 9. PHP PHP 5.4 http://www.1x1.jp/blog/ 2011/06/ try_new_php_without_update _current_version.html configure make
  • 10. Windows • http://windows.php.net/qa/ • Mac • XCode + MacPorts or Homebrew • Linux •
  • 11. % curl -o php-5.4.0RC1.tar.gz http://downloads.php.net/stas/ php-5.4.0RC1.tar.gz % tar xzf php-5.4.0RC1.tar.gz % cd php-5.4.0RC1 % ./configure --prefix=/opt/local/php/5.4 --bindir=/opt/local/bin --with-config-file-path=/opt/local/php/5.4/etc --with-config-file-scan-dir=/opt/local/php/5.4/var/db --mandir=/opt/local/php/5.4/share/man --infodir=/opt/local/php/5.4/share/info --program-suffix=-5.4 --with-apxs2=/opt/local/apache2/bin/apxs ( https://gist.github.com/1344162 ) % make
  • 12. (make install) sapi/cli/php configure PHP
  • 13. % sapi/cli/php -v PHP 5.4.0RC1 (cli) (built: Nov 23 2011 23:08:40) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend Technologies % sapi/cli/php -a Interactive shell php >
  • 14. php > echo “Hello Worldn”; Hello World php > print_r(array_map(function($x){ return $x * 2; }, range(0,9))); Array ( [0] => 0 [1] => 2 [2] => 4 [3] => 6 [4] => 8 [5] => 10 [6] => 12 [7] => 14 [8] => 16 [9] => 18 ) : php > echo 0xff == 0b11111111, "n"; 1
  • 19. var $belongsTo = array( ! 'User' ); var $hasMany = array( 'Photo' => array( 'order' => 'number' ) ); var $belongsTo = [ ! 'User' ]; var $hasMany = [ 'Photo' => [ 'order' => 'number' ] ];
  • 20. $this->render('list', array( 'posts' => Post::find(array( 'limit' => Config::get('postsPerPage', array('context'=>'blog', 'default'=>10)), )) )); ? $this->render('list', [ 'posts' => Post::find([ 'limit' => Config::get('postsPerPage', ['context'=>'blog', 'default'=>10]), ]) ]);
  • 22. $this->render('list', array( 'posts' => Post::find(array( 'limit' => Config::get('postsPerPage', array('context'=>'blog', 'default'=>10)), )) )); $this->render('list', [ 'posts' => Post::find([ 'limit' => Config::get('postsPerPage', ['context'=>'blog', 'default'=>10]), ]) ]);
  • 23. $this->render('list', array( 'posts' => Post::find(array( 'limit' => Config::get('postsPerPage', array('context'=>'blog', 'default'=>10)), )) )); $this->render('list', [ 'posts' => Post::find([ 'limit' => Config::get('postsPerPage', ['context'=>'blog', 'default'=>10]), ]) ]); Array
  • 24. $this->render('list', array( 'posts' => Post::find(array( 'limit' => Config::get('postsPerPage', array('context'=>'blog', 'default'=>10)), )) )); $this->render('list', [ 'posts' => Post::find([ 'limit' => Config::get('postsPerPage', ['context'=>'blog', 'default'=>10]), ]) ]); [ ... ]
  • 25. ARRAY SHORT SYNTAX • → • • PHP • Array
  • 26. ARRAY SHORT SYNTAX • PHP array YAML • PHP
  • 29. % sapi/cli/php -S localhost:8080
  • 30. Javascript Flash file:// API → PHP5.4 • Apache • PHP
  • 31. .htaccess mod_rewrite
  • 32. PHP % sapi/cli/php -S localhost:8080 builtin-server.php
  • 33. list($path, $param) = array_merge( preg_split('/?/', $_SERVER['REQUEST_URI'], 2), ['', ''] ); if($path != '/' && (file_exists('app/webroot' . $path))) { header(sprintf('Location: http://%s/app/webroot%s', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])); exit; } else if($path != '/' && (file_exists('./' . $path))) { return false; } else { $_SERVER['PATH_INFO'] = $path; require 'app/webroot/index.php'; }
  • 34. % ~/php54/php-5.4.0RC1/sapi/cli/php -S localhost:8080 builtin-server.php
  • 36. PHP 5.4.0RC1 Development Server started at Thu Nov 24 02:11:37 2011 Listening on localhost:8080 Document root is /Users/tanakahisateru/Sites/cakephp2 Press Ctrl-C to quit. [Thu Nov 24 02:11:42 2011] ::1:63556 [200]: /app/webroot/css/cake.generic.css [Thu Nov 24 02:11:42 2011] ::1:63557 [200]: /app/webroot/img/cake.power.gif [Thu Nov 24 02:11:42 2011] ::1:63558 [200]: /app/webroot/img/cake.icon.png [Thu Nov 24 02:11:42 2011] ::1:63564 [200]: /app/webroot/favicon.ico
  • 37. MacPorts MySQL php.ini % ~/php54/php-5.4.0RC1/ sapi/cli/php -c ~/php54/ php-5.4.0RC1/ -S localhost:8080 builtin-server.php ~/php54/php-5.4.0RC1/php.ini [Pdo_mysql] pdo_mysql.default_socket=/opt/local/var/run/mysql5/mysqld.sock MySQL
  • 38. BUILT-IN SERVER • URL OK • Apache • PHP5.3 Apache mod_php PHP5.4
  • 39. TRAIT
  • 40. NO.1
  • 41. TRAIT • • Ruby mixin • PHP (instanceof ) •
  • 43. 1 INCLUDE / REQUIRE • • HTML • /
  • 44. 2 • • • class AppModel extends Model class GuestUser extends AppModel class AdminUser extends AppModel User
  • 45. class AppModel extends Model { } class GuestUser extends AppModel { public function getDisplayLabel() { ...; } } !! class AdminUser extends AppModel { public function getDisplayLabel() { ...; } public function getAdminRioleType() { ...; } }
  • 46. class AppModel extends Model { public function getDisplayLabel() { ...; } } class GuestUser extends AppModel { } class AdminUser extends AppModel { public function getAdminRioleType() { ...; } }
  • 47. class AppModel extends Model { public function getDisplayLabel() { return $this->username . “ ”; } } class GuestUser extends AppModel { } class AdminUser extends AppModel { public function getAdminRoleType() { ...; } } class Comment extends AppModel { // username ← }
  • 48. UserModel.inc public function getDisplayLabel() { return $this->username . “ ”; } class GuestUser extends AppModel { require ‘UserModel.inc’; } class AdminUser extends AppModel { require ‘UserModel.inc’; public function getAdminRoleType() { ...; } } class Comment extends AppModel { } ... require = orz
  • 49. trait UserModel { public function getDisplayLabel() { return $this->username . “ ”; } } class GuestUser extends AppModel { use UserModel; } class AdminUser extends AppModel { use UserModel; public function getAdminRoleType() { ...; } } class Comment extends AppModel { }
  • 51. trait PersistentModel { public function save() { } = } abstract class User { = public function getDisplayLabel() { return $this->username . “ ”; } } class GuestUser extends User inplements Persistence { use PersistentModel; } class AdminUser extends User inplements Persistence { use PersistentModel; public function getAdminRoleType() { ...; } }
  • 57. call_user_func php > $fun = 'intval'; php > echo call_user_func($fun, "0001abc"), "n"; 1 php > echo is_callable($fun), "n"; 1 php > echo is_string($fun), "n"; 1 php > echo $fun("0001abc"), "n"; 1
  • 58. call_user_func array php > $obj = new Exception('hoge'); php > $msg = [$obj, 'getMessage']; php > echo call_user_func($msg), "n"; hoge php > echo is_callable($msg), "n"; 1 php > echo is_array($msg), "n"; 1 php > echo $msg(), "n"; hoge
  • 59. php > echo $closure(), "n"; // string array ↓ is_callable Array
  • 61. PHP5.3 <?php class CounterFactory { function __construct($init) { $this->init = $init; } function createCounter() { $c = 0; return function() use(&$c) { return $this->init + ($c++); }; } } $fact = new CounterFactory(100); $c1 = $fact->createCounter(); $c2 = $fact->createCounter(); echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n"; echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n"; echo "c1:", $c1(), "n";
  • 62. PHP5.3 <?php class CounterFactory { function __construct($init) { $this->init = $init; } function createCounter() { $c = 0; $self = $this; return function() use($self, &$c) { return $self->init + ($c++); }; } } $fact = new CounterFactory(100); $c1 = $fact->createCounter(); $c2 = $fact->createCounter(); echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n"; echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n"; echo "c1:", $c1(), "n";
  • 64. PHP5.4 OK! <?php class CounterFactory { function __construct($init) { $this->init = $init; } function createCounter() { $c = 0; return function() use(&$c) { return $this->init + ($c++); }; } } $fact = new CounterFactory(100); $c1 = $fact->createCounter(); $c2 = $fact->createCounter(); echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n"; echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n"; echo "c1:", $c1(), "n";
  • 65. <?php class CounterFactory { function __construct($init) { $this->init = $init; } function createCounter() { $c = 0; return function() use(&$c) { return $this->init + ($c++); }; } } $fact = new CounterFactory(100); $c1 = $fact->createCounter(); $c2 = $fact->createCounter(); echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n"; echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n"; echo "c2:", $c2(), "n"; echo "c1:", $c1(), "n"; c1:100 <-- init=100 + c=0 c1:101 <-- init=100 + c=1 c2:100 <-- init=100 + c=0 c2:101 <-- init=100 + c=1 c2:102 <-- init=100 + c=2 c1:102 <-- init=100 + c=2
  • 67. $THIS <?php class CounterFactory { function __construct($init) { $this->init = $init; } function createCounter() { $c = 0; return function() use(&$c) { return $this->init + ($c++); }; } } $fact = new CounterFactory(100); $c1 = $fact->createCounter(); echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n"; $c1 = $c1->bindTo(new CounterFactory(1000)); echo "c1:", $c1(), "n";
  • 68. <?php class CounterFactory { function __construct($init) { $this->init = $init; } function createCounter() { $c = 0; return function() use(&$c) { return $this->init + ($c++); }; } } $fact = new CounterFactory(100); $c1 = $fact->createCounter(); echo "c1:", $c1(), "n"; echo "c1:", $c1(), "n"; $c1 = $c1->bindTo(new CounterFactory(1000)); echo "c1:", $c1(), "n"; c1:100 <-- init=100 + c=0 c1:101 <-- init=100 + c=1 c1:1002 <-- init=1000 + c=2
  • 69. CLOSURE • PHP5.4 create_function • Javascript this • $this $this • → PHP5.3 $self bindTo PHP5.4 $this
  • 70. <?php <?php class Hoge { class Hoge { function __construct($init) { function __construct($init) { $this->init = $init; $this->init = $init; } } function x($n) { function x($n) { $tmp = []; return array_map( for($i=0; $i<$n; $i++) { function() { $tmp[] = $this->init; return $this->init; } }, range(0,$n-1) return $tmp; ); } } } } print_r((new Hoge(100))->x(3)); print_r((new Hoge(100))->x(3));
  • 72. • new • array
  • 74. PHP5.3 PHP5.4 OK echo (new Exception("hoge"))->getMessage(), "n";
  • 75. PHP5.3 PHP5.4 OK echo range(0, 9)[5], “n”;
  • 76. PHP5.4.0RC1 php > echo (array(1, 2, 3))[0], "n"; Parse error: syntax error, unexpected '[', expecting ',' or ';' in php shell code on line 1 php > echo (function($x){ return $x * 2; })(10), "n"; Parse error: syntax error, unexpected '(', expecting ',' or ';' in php shell code on line 1
  • 79. PHP5.4 • PHP5.3 5.2 • • Phar • PHP5.4