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