3 คะแนน โดย smartbosslee 2020-07-16 | 3 ความคิดเห็น | แชร์ทาง WhatsApp
<p>// Before<br /> switch ($this-&gt;lexer-&gt;lookahead['type']) {<br /> case Lexer::T_SELECT:<br /> $statement = $this-&gt;SelectStatement();<br /> break;<br /> <br /> case Lexer::T_UPDATE:<br /> $statement = $this-&gt;UpdateStatement();<br /> break;<br /> <br /> case Lexer::T_DELETE:<br /> $statement = $this-&gt;DeleteStatement();<br /> break;<br /> <br /> default:<br /> $this-&gt;syntaxError('SELECT, UPDATE or DELETE');<br /> break;<br /> }<br /> <br /> // After<br /> $statement = match ($this-&gt;lexer-&gt;lookahead['type']) {<br /> Lexer::T_SELECT =&gt; $this-&gt;SelectStatement(),<br /> Lexer::T_UPDATE =&gt; $this-&gt;UpdateStatement(),<br /> Lexer::T_DELETE =&gt; $this-&gt;DeleteStatement(),<br /> default =&gt; $this-&gt;syntaxError('SELECT, UPDATE or DELETE'),<br /> };</p>

3 ความคิดเห็น

 
kunggom 2020-07-17
<p>ใน Java เองก็มีคำสั่ง Switch ที่พัฒนาความสามารถมากขึ้นถูกเพิ่มเข้ามาในเวอร์ชันใหม่เช่นกัน ดูเหมือนว่านี่จะเป็นเทรนด์ในช่วงนี้นะครับ<br /> https://th.news.hada.io/topic?id=1130</p&gt;
 
xguru 2020-07-16
<p>ฟีเจอร์ใหม่ของ PHP 8 https://th.news.hada.io/topic?id=1438<br /> <br /> ตอนโพสต์ข่าวนี้เหมือนจะยังไม่มี แต่ในต้นฉบับของบทความฝั่งนี้ก็อัปเดตล่าสุดและเพิ่ม Match เข้าไปแล้วครับ</p>
 
smartbosslee 2020-07-16
<p>ครับ มีการยืนยันแน่ชัดแล้วว่าจะเพิ่มเข้ามา แต่ดูเหมือนว่า `Match` เองก็ยังมีโอกาสที่จะถูกเปลี่ยนแปลงเพิ่มเติมได้อยู่ครับ<br /> ขอบคุณสำหรับลิงก์ครับ</p>