I still got the error
Fatal error: Maximum execution time of 30 seconds exceeded in H:\xampp\htdocs\NOVO\class.php on line 2
Can you copy paste what you have please
here is the class.php
<?php
include("index.php");
class february
{
private $year;
public function __construct($year)
{
$this->year = $year;
}
public function numDays()
{
$d = new DateTime("{$this->year}-02-01");
return $d->format('t');
}
}
?>
i copied your solution in my index.php script but i got this error
Fatal error: Maximum execution time of 30 seconds exceeded in H:\xampp\htdocs\PHP1\index.php on line 2
I really don't know.It just wont work.
The thing is i need to make 2 node++ files. One is index.php where is the drop down with years from 1900 to 2015 and where i call the class february.
And the second script is class.php where is the class...Here is the code in those scripts...please reply if you can fix my problem.
class.php
<?php
include("index.php");
class february
{
private $year;
public function __construct($year)
{
$this->year = $year;
}
public function numDays()
{
$d = new DateTime("{$this->year}-02-01");
return $d->format('t');
}
}
?>
index.php
<?php
include("class.php");
$cutoff = date(1900);
$now = date('Y');
echo '<select name="year">' . PHP_EOL;
for ($y=$now; $y>=$cutoff; $y--) {
echo ' <option value="' . $y . '">' . $y . '</option>' . PHP_EOL;
}
echo '</select>' . PHP_EOL;
$f = new february((int)$_POST['year']);
echo $f->numdays();
?>
I need this logic in Class not just the function
This is the drop down list
$cutoff = 1900;
$now = date('Y');
// YEARS
echo '<select name="year">' . PHP_EOL;
for ($y=$now; $y>=$cutoff; $y--) {
echo ' <option value="' . $y . '">' . $y . '</option>' . PHP_EOL;
}
echo '</select>' . PHP_EOL;
Now i need to get number of days in february by clicking
Only class varianty... please...tnx
Hello guys
I really need some help please
I need to create a class, for example "yearCheckFeb"
I have a drop down list with years from 1900 to 2015 and when you choose a year you must get number of days in february.
Can someone help my with this,please
Thanks
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.