3 puan yazan smartbosslee 2020-07-16 | 3 yorum | WhatsApp'ta paylaş

// Önce

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;

}

// Sonra

$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'),

};

3 yorum

 
kunggom 2020-07-17

Java'da da işlevleri geliştirilmiş Switch ifadesi en yeni sürümlere girmişti. Görünüşe göre bu aralar trend bu.

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

 
xguru 2020-07-16

PHP 8'in yeni özellikleri https://tr.news.hada.io/topic?id=1438

Bu haberi paylaşırken yok gibiydi ama bu taraftaki yazının orijinali de güncellenerek Match eklenmiş.

 
smartbosslee 2020-07-16

Evet. Ekleneceği kesinleşti, ancak Match’in kendisinde de hâlâ daha fazla değişiklik yapılma ihtimali varmış.

Bağlantı için teşekkürler.