Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Community
General Tabletop Discussion
*Geek Talk & Media
Who knows PHP?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Morrus" data-source="post: 7466884" data-attributes="member: 1"><p>I've been teaching myself PHP this last week so that I can write my own web apps (character builders and the like). It's coming along well, but I've run into a block. I'm hoping that one of the many clever people on EN World can help me!</p><p></p><p>So....</p><p></p><p>I have an array:</p><p></p><p>skill[1]</p><p>skill[2]</p><p>skill[3]</p><p>... all the way to skill[13]</p><p></p><p>In each slot, there is the name of a skill, such as running, or stealth, or computers, or herbalism, etc.</p><p></p><p>The problem is that some slots will be duplicated. For example, the user may have selected herbalism three items during the character creation process, so three of those 13 slots are "herbalism".</p><p></p><p>What I need is a list of skills, and the number of times they've been taken. So rather than:</p><p></p><p>1. running</p><p>2. herbalism</p><p>3. jumping</p><p>4. computers</p><p>5. running</p><p>6. running</p><p>7. chess</p><p>8. woodworking</p><p>9. dodging</p><p>10. dodging</p><p>11. computers</p><p>12. swords</p><p>13. bows</p><p></p><p>I need:</p><p></p><p>1. running 3</p><p>2. dodging 2</p><p>3. computers 2</p><p>4. herbalism 1</p><p>5. chess 1</p><p>6. woodworking 1</p><p>7. swords 1</p><p>8. bows 1</p><p>9. jumping 1</p><p></p><p>So I need some kind of function to take that first list and turn it into the second list.</p><p></p><p>I know there's an array_count_values function in PHP, and I can get it to split out those values on the screen, but I don't know how to "work" with those values to put them into some kind of new array I can use.</p><p></p><p>Anybody got any ideas? Does that even make sense?</p></blockquote><p></p>
[QUOTE="Morrus, post: 7466884, member: 1"] I've been teaching myself PHP this last week so that I can write my own web apps (character builders and the like). It's coming along well, but I've run into a block. I'm hoping that one of the many clever people on EN World can help me! So.... I have an array: skill[1] skill[2] skill[3] ... all the way to skill[13] In each slot, there is the name of a skill, such as running, or stealth, or computers, or herbalism, etc. The problem is that some slots will be duplicated. For example, the user may have selected herbalism three items during the character creation process, so three of those 13 slots are "herbalism". What I need is a list of skills, and the number of times they've been taken. So rather than: 1. running 2. herbalism 3. jumping 4. computers 5. running 6. running 7. chess 8. woodworking 9. dodging 10. dodging 11. computers 12. swords 13. bows I need: 1. running 3 2. dodging 2 3. computers 2 4. herbalism 1 5. chess 1 6. woodworking 1 7. swords 1 8. bows 1 9. jumping 1 So I need some kind of function to take that first list and turn it into the second list. I know there's an array_count_values function in PHP, and I can get it to split out those values on the screen, but I don't know how to "work" with those values to put them into some kind of new array I can use. Anybody got any ideas? Does that even make sense? [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Geek Talk & Media
Who knows PHP?
Top