how can i do this :
it'a a project for my universety and i really need it so here i go:
first step. i need to right my birth date (let's say 25.03.1982) ->the first number
2. from my birth date i have to do this - > 2+5+0+3+1+9+8+2 = 30 -> the second number
3. now 3+0 = 3 (if it was 34 thant it's 7,if it was a number over 10 (like 5+6 =11) then it's 1 etc.) -> third number
4. now 30 - 2*2 ( the first 2 is from my birthday date and the second 2 is a number to use at all situations) = 26
5. and now 2+6 (from the step number 4) = 8
6.now we have : 25.03.1982.30.3.26.8
7. i have 1 -> 1 times (from 1982 ); 2 ->3 times (from 25,1982 and 26);3 ->3 times(from 03,30 and 3);4 ->0 times(from and so on till 10 .
8. all this is going to a table like this:
-----------------------
1 | - | - |
-----------------------
222 | 5 | 88 |
----------------------
333 | 6 | 9 |
----------------------
how do i do this ? please help
THANKS
how to do this ???
Moderator: General Moderators
- discobean
- Forum Commoner
- Posts: 49
- Joined: Sun May 18, 2003 9:06 pm
- Location: Sydney, Australia
- Contact:
here u go
This is as far as I got in the spare time I had...
I figure your a student, so u should figure out the rest of it yourself...
Mind you, I don't like the way it generates the third number, but pff, you'll get a pass eh
I figure your a student, so u should figure out the rest of it yourself...
Mind you, I don't like the way it generates the third number, but pff, you'll get a pass eh
Code: Select all
$birthdate = "25.03.1982";
$first_number = preg_replace("/[^0-9]/", "", $birthdate);
$second_number = (string)addnums($first_number);
if(($third_number = $second_number[0]+$second_number[1]) >= 10)
$third_number = 1;
$fourth_number = $second_number - ($birthdate[0] * 2);
$fifth_number = addnums($fourth_number);
echo <<<HTML
First Number: {$first_number}<br />
Second Number: {$second_number}<br />
Third Number: {$third_number}<br />
Fourth Number: {$fourth_number}<br />
Fifth Number: {$fifth_number}<br />
HTML;
function addnums($nums)
{
foreach(preg_split("//", (string)$nums) as $num)
$outnum+=$num;
return $outnum;
}