1
我現在有一個顯示像這樣的數據代碼:有序列表組數字,符號
1
11 Title Here
2
21 Guns
A
Awesome
使用此:
foreach($animes as $currentAnime){
$thisLetter = strtoupper($currentAnime->title[0]);
$sorted[$thisLetter][] = array('title' => $currentAnime->title, 'id' => $currentAnime->id);
unset($thisLetter);
}
我怎麼組中的所有號碼爲#
,所有的符號a ~
?
像這樣:
#
11 Title Here
21 Guns
~
.ahaha
A
Awesome
謝謝你的建議。
如果這是一個數字和preg_match(如果這是一個符號並向數組添加另一個維度),則可以使用is_numeric()進行檢查。 – Robert