Quick Variable Question
hey i was trying to make my program dynamic by adding variables, but it always comes out with the same calcualtions with different variable values, when the static version works fine...am I doing something wrong? the PHP version on the server is v4. I need an form page to send this script the variable data, so i need ithe dynamic script to work. thanks guys!
static-works:
<html>
<head>
<title>Age ****</title>
</head>
<body>
<p>
<?php
function years() {
return (days() / 365);
}
function days() {
return (hours() / 24);
}
function hours() {
return (minutes() / 60);
}
function minutes() {
return (seconds() / 60);
}
function seconds() {
return (time() - mktime(0, 0, 0, 8, 23, 1987));
}
echo 'Jesse is ' . round(years(), 2) . ' years old, ';
echo round(days()) . ' days old, ';
echo round(hours()) . ' hours old, ';
echo round(minutes()) . ' minutes old, ';
echo 'and ' . round(seconds()) . ' seconds old.';
?>
</p>
</body>
</html>
dynamic-doesn't work:
<html>
<head>
<title>Age ****</title>
</head>
<body>
<p>
<?php
$name = 'Jesse';
$month = 8;
$day = 23;
$year = 1987;
function years() {
return (days() / 365);
}
function days() {
return (hours() / 24);
}
function hours() {
return (minutes() / 60);
}
function minutes() {
return (seconds() / 60);
}
function seconds() {
return (time() - mktime(0, 0, 0, $month, $day, $year));
}
echo $name . ' is ' . round(years(), 2) . ' years old, ';
echo round(days()) . ' days old, ';
echo round(hours()) . ' hours old, ';
echo round(minutes()) . ' minutes old, ';
echo 'and ' . round(seconds()) . ' seconds old.';
?>
</p>
</body>
</html>
___________________
