1--TEST-- 2Match expression long jump table 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.opt_debug_level=0x20000 7--EXTENSIONS-- 8opcache 9--FILE-- 10<?php 11 12function test($char) { 13 return match ($char) { 14 1 => '1', 15 2, 3 => '2, 3', 16 4 => '4', 17 5, 6 => '5, 6', 18 7 => '7', 19 8, 9 => '8, 9', 20 default => 'default' 21 }; 22} 23 24foreach (range(0, 10) as $char) { 25 var_dump(test($char)); 26} 27 28?> 29--EXPECTF-- 30$_main: 31 ; (lines=15, args=0, vars=1, tmps=2) 32 ; (after optimizer) 33 ; %s 340000 INIT_FCALL 2 %d string("range") 350001 SEND_VAL int(0) 1 360002 SEND_VAL int(10) 2 370003 V2 = DO_ICALL 380004 V1 = FE_RESET_R V2 0013 390005 FE_FETCH_R V1 CV0($char) 0013 400006 INIT_FCALL 1 %d string("var_dump") 410007 INIT_FCALL 1 %d string("test") 420008 SEND_VAR CV0($char) 1 430009 V2 = DO_UCALL 440010 SEND_VAR V2 1 450011 DO_ICALL 460012 JMP 0005 470013 FE_FREE V1 480014 RETURN int(1) 49LIVE RANGES: 50 1: 0005 - 0013 (loop) 51 52test: 53 ; (lines=9, args=1, vars=1, tmps=0) 54 ; (after optimizer) 55 ; %s 560000 CV0($char) = RECV 1 570001 MATCH CV0($char) 1: 0002, 2: 0003, 3: 0003, 4: 0004, 5: 0005, 6: 0005, 7: 0006, 8: 0007, 9: 0007, default: 0008 580002 RETURN string("1") 590003 RETURN string("2, 3") 600004 RETURN string("4") 610005 RETURN string("5, 6") 620006 RETURN string("7") 630007 RETURN string("8, 9") 640008 RETURN string("default") 65string(7) "default" 66string(1) "1" 67string(4) "2, 3" 68string(4) "2, 3" 69string(1) "4" 70string(4) "5, 6" 71string(4) "5, 6" 72string(1) "7" 73string(4) "8, 9" 74string(4) "8, 9" 75string(7) "default" 76