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
asDateTime, $param2
without type-hinting as it may have a mixed type of value, and$param3
is optional with a defaultNULL
value. Also, inside the body, the function contains one integer type variable and returns that integer type as well.2. Type
/**
in the line before thetestFunc
function, and press Enter. You can see that NetBeans parses...