general mathematics question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

general mathematics question

Post by Obadiah »

say I have 3 numbers either in descending or ascending order for poops and hops lets say they are 3, 6, 7 or 9, 8, 4 both sets of numbers represent letters c, d, f. How do I get the number for letters a and b
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: general mathematics question

Post by manohoo »

Not sure I understand your question... how can 2 different set of numbers represent the same letters?
Anyway, you might want to explore associative arrays. See this example:

Code: Select all

$set1 = array('a'=>1, 'b'=>2, 'c'=>3);
$set2 = array('d'=>7, 'e'=>8, 'f'=>9);

echo $set1['a']; // 1
echo $set2['f']; // 9
echo $set1['b'] + $set2['d']; //9
Post Reply