可以统计重复数量吗?
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.7k
- Forks
- 253
- PR merge metrics
- No merged PRs in 30d
Description
在写一个项目,需要统计表中的每个“publish”的数量并列出来,比如说表“list”:
+------+----------+
| id | publish |
+------+----------+
| 1 | 小明 |
| 2 | 小红 |
| 3 | 小刚 |
| 4 | 小明 |
| 5 | 小明 |
| 6 | 小刚 |
| 7 | 小明 |
| 8 | 小刚 |
+------+----------+
然后我想要结果是:
array(
array('小明'=>4),
array('小刚'=>3),
array('小红'=>1),
);
请问要怎么写?(对不起,我PHP还是新手)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or entry point is named; start by reviewing how this PHP project accesses the example list table and the issue's requested result. Done means producing one count for each distinct publish value, matching the shown array format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100