# PHP 8에 Match 표현식이 추가됩니다

> Clean Markdown view of GeekNews topic #2455. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=2455](https://news.hada.io/topic?id=2455)
- GeekNews Markdown: [https://news.hada.io/topic/2455.md](https://news.hada.io/topic/2455.md)
- Type: news
- Author: [smartbosslee](https://news.hada.io/@smartbosslee)
- Published: 2020-07-16T07:34:23+09:00
- Updated: 2020-07-16T07:34:23+09:00
- Original source: [laravel-news.com](https://laravel-news.com/match-expression-php-8)
- Points: 3
- Comments: 3

## Topic Body

// Before

switch ($this->lexer->lookahead['type']) {

    case Lexer::T_SELECT:

        $statement = $this->SelectStatement();

        break;

    case Lexer::T_UPDATE:

        $statement = $this->UpdateStatement();

        break;

    case Lexer::T_DELETE:

        $statement = $this->DeleteStatement();

        break;

    default:

        $this->syntaxError('SELECT, UPDATE or DELETE');

        break;

}

// After

$statement = match ($this->lexer->lookahead['type']) {

    Lexer::T_SELECT => $this->SelectStatement(),

    Lexer::T_UPDATE => $this->UpdateStatement(),

    Lexer::T_DELETE => $this->DeleteStatement(),

    default => $this->syntaxError('SELECT, UPDATE or DELETE'),

};

## Comments



### Comment 2305

- Author: kunggom
- Created: 2020-07-17T00:42:27+09:00
- Points: 1

Java에서도 기능이 향상된 Switch문이 최신 버전에 들어갔지요. 이런 게 요즘 대세인가 봅니다.

https://news.hada.io/topic?id=1130

### Comment 2294

- Author: xguru
- Created: 2020-07-16T07:39:34+09:00
- Points: 1

PHP 8 의 새 기능들 https://news.hada.io/topic?id=1438

위 뉴스 올릴때에는 없었던거 같은데, 이쪽 글 원본에도 최신을 반영해서 Match 가 추가되었네요.

### Comment 2297

- Author: smartbosslee
- Created: 2020-07-16T09:51:39+09:00
- Points: 1
- Parent comment: 2294
- Depth: 1

네. 추가되는건 확정인데, Match 자체도 아직 더 변경될 여지가 남아있다고 합니다.

링크 감사합니다.
