function name($key, $value) {
switch($key) {
case 'name':
break;
// this is where I would determine the key with this pattern 1-100
case 'promote-'.count++ :
break;
}
}
當我呼應$key
樣本輸出將是contact_number
,card_name
和我想圖案以確定promote-1
,promote-2
等。第二個選項「案例」促進 - '。count ++'是我需要確定的模式。任何「促進-1」到「促進-100」將落在該選項
'count'是不是合法的變量,你不串聯[正則表達式的正確 – 2014-11-03 06:09:46
可能重複在switch語句](http://stackoverflow.com/questions/4043741/regexp-in-switch-statement) – Ohgodwhy 2014-11-03 06:15:27
謝謝@SterlingArcher,這只是一個例子,它會是什麼樣子。當我回顯$ key時,我需要用這個值'promotion-1','promote-2'等來放置這個$ key。我需要爲我的開關盒檢測這種模式。任何幫助將不勝感激。 – heero 2014-11-03 06:18:19