While I am practicing for PHP I want to make a function with PHP for
loop
function Yearsbox(,) {
for ($i=2000; $i < 2020 ; $i++) {
echo $i;
}
}
echo Yearsbox;
What is wrong?
While I am practicing for PHP I want to make a function with PHP for
loop
function Yearsbox(,) {
for ($i=2000; $i < 2020 ; $i++) {
echo $i;
}
}
echo Yearsbox;
What is wrong?
You may not give a single comma as an argument to the function. Either give your parameter a valid name or leave the brackets empty.
Second, you call a function with brackets (forget what i wrote before, you have to add them, otherwise php interprets it as a constant)
This is what should work:
function Yearsbox() {
for ($i=2000; $i < 2020 ; $i++) {
echo $i;
}
}
Yearsbox();