Functions within functions

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
kloining
Forum Newbie
Posts: 1
Joined: Fri Jan 28, 2005 7:16 am

Functions within functions

Post by kloining »

Hi guys, been searching "all over the web" now to find a solution, but it's "impossible". :(

Anyway, here's the problem:

Code: Select all

<?php
class pub
&#123;
	function a()
	&#123;
		function b()&#123; &#125;
	&#125;
&#125;
?>
I know I can call the b()-function by doing this:
pub::a();
b();

But after calling pub::a();
I want to be able to call pub::b();

Regards, Kristian
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it has to be defined as part of the class. i.e. it has to be in the class' definition, not a function implementation.
Post Reply