Page 1 of 1

funcion within a function

Posted: Mon Aug 18, 2003 4:28 pm
by mccommunity
I have written a function and I have another function that I would like to execute within the first function. Can I do this with functions in php?

Posted: Mon Aug 18, 2003 5:26 pm
by Gen-ik
Try it and find out......

Code: Select all

<?php
function FA()
{
$result = FB();
return $result;
}

function FB()
{
return "Hello";
}

echo(FA());
?>

I've never tried it so I can't give you an answer, but if you are starting to use functions within functions then it might be a good idea to learn how to use Classes instead.

Posted: Tue Aug 19, 2003 4:18 am
by twigletmac
Functions within functions does work - it is simplest (as Gen-ik pointed out) to test this sort of thing yourself.

Mac