Programming Tutorials

Function within another function in PHP

By: Martyniuk Vasyl in PHP Tutorials on 2011-10-28  

If you define function within another function, it can be accessed directly, but after calling parent function.

For example:

function a () {
function b() {
echo "I am b.";
echo "I am a.<br/>";
//b(); Fatal error: Call to undefined function b() in E:\..\func.php on line 8
a(); // Print I am a.
b(); // Print I am b.

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in PHP )

Latest Articles (in PHP)