O'Reilly logo

PHP Application Development with NetBeans Beginner's Guide by M A Hossain Tonu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — documenting a PHP function or method

In this tutorial, let's create a simple PHP function or method with some parameters passed into it and different types of variables declared inside it. We are just practicing to see how the NetBeans auto documentation generator works on such commonly used structural elements. Let's go through the following steps:

  1. Add a PHP file named sample1.php into the project, and type a PHP function as follows:
    function testFunc(DateTime $param1, $param2, string $param3 = NULL)
    {
    $number = 7;
    return $number;
    }
    

    In this function we can see that there are three parameters passed into the testFunc method—$param1 as DateTime, $param2 without type-hinting as it may have a mixed type of value, and $param3 is optional ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required