leeftijd-berekenen-jaarmaandendagenuur-minuten

Gesponsorde koppelingen

PHP script bestanden

  1. leeftijd-berekenen-jaarmaandendagenuur-minuten

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?
$birth
['year']     = "2005";
$birth['month']     = "08";
$birth['day']     = "23";
$birth['hour']     = "04";
$birth['minute']     = "36";

if ($birth['minute'] > date("i"))            
    {

    $total['minute'] = (60 - $birth['minute'] + date("i"));
    $total['hour'] = -1;
    }

else
    {
    $total['minute'] = (date("i") - $birth['minute']);
    }


if ($birth['hour'] > date("H"))
    {

    $total['hour'] = ($total['hour'] + (24 - $birth['hour'] + date("H")));
    $total['day'] = -1;
    }

else
    {
    $total['hour'] = ($total['hour'] + (date("H") - $birth['hour']));
    }


if ($birth['day'] > date("d"))
    {

    $total['day'] = ($total['day'] + (date("t",mktime(00,00,00,(date("m") - 1),01,date("Y"))) - $birth['day'] + date("d")));
    $total['month'] = -1;
    }

else
    {
    $total['day'] = ($total['day'] + (date("d") - $birth['day']));
    }


if ($birth['month'] > date("m"))
    {

    $total['month'] = ($total['month'] + (12 - $birth['month'] + date("m")));
    $total['year'] = -1;
    }

else
    {
    $total['month'] = ($total['month'] + (date("m") - $birth['month']));
    }


$total['year'] = ($total['year'] + (date("Y") - $birth['year']));



echo("<div>");
echo("Sara is nu ");
if ($total['year'] > 0)        { echo("".$total['year']." jaar "); }
if ($total['month'])        { echo("".$total['month']." maand"); if ($total['month']!=1){echo("en");}}
echo(" ");
if ($total['day'])            { echo("".$total['day']." dag"); if ($total['hour']!=1){echo("en");}}
echo(" ");
if ($total['hour'])            { echo("".$total['hour']." uur "); }
echo("en ");
if ($total['minute'])        { echo("".$total['minute']." minuten "); }
echo("oud.");
echo("</div>");

?>