[SOLVED] Calling a function from a function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mshita
Forum Commoner
Posts: 32
Joined: Sat Jul 03, 2004 8:55 pm
Location: Portland, OR
Contact:

Calling a function from a function

Post by mshita »

Hi,

How do I call a function from inside another function? Like

Code: Select all

function blabla()
{
.......
blaanother();
}

function blaanother()
{
...
}
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

exactly like that?

Code: Select all

function blah1(){
$a = 7;
$b = blah2();
$c = $a+$b;
echo $c;
}

function blah2(){
return 4;
}
Prints 11.
mshita
Forum Commoner
Posts: 32
Joined: Sat Jul 03, 2004 8:55 pm
Location: Portland, OR
Contact:

Post by mshita »

It worked.....it didn't work the first time I tried. I must have done something weird.

Thanks :)
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

No problem. Good luck :)
Post Reply