i have a data like this:
i would like to group these with PHP, not mysql, since it just PHP file, not mysql.
I want the output is:
- test: 1|2|4|
- test2: 3|5|6|
- test3: 7|
How can i do that with PHP?
Thanks, need for your help, since i just a newbie with PHP. Can find any help at search engine.
grouping using php script
Say the data you have is in a file, you'll need to use associative arrays to get the job done!
So you just print out the array $arr to get the desired output.
Thanks for your help. At the beginning, i just feel that i have to use foreach. but i have no idea how to do that.
You help me out of this case.
But i still get the problem.
i make the script like this:
i just want, the result is: test:1|2|4|;test2:3|5|6|;test3:7|
So, i can explode the result to get the value of test, test2 and test3.
Can you help me?
And Pradeep, can you help me to teach about class and function? Where the article i can read and learn. I mean the simple one, that i can learn better.