Kevin Kevin - 14 days ago 5
PHP Question

Multiple function tasks php

I have a question about a function using php.

Can i for example have a function with the same name do multiple things.

e.g

function name () {
echo "this";
}

function name () {
echo "that";
}

name();


so the same function doing multiple tasks.

Answer

No, this is not possible, and will yield

Fatal error: Cannot redeclare name() (previously declared in ...) in php shell code on line ...

Comments