Syntax:int ReflectionClass::getStartLine (void)
Parameters:This function takes no parameters.
Return Value:This function returns the line number that the user-defined class begins with.The following programs illustrate the ReflectionClass::getStartLine() function in PHP:
Program 1:
// Definition of a class named Departments
class
Departments {}
// Using ReflectionClass over the Departments class
$ReflectionClass
=
new
ReflectionClass (
’Departments’
);
// Calling getStartLine() functions
$A
=
$ReflectionClass
-> getStartLine();
// Get the starting line number
// specified class
var_dump (
$A
);
?>
Output: int (4)
Program 2:
// Definition of a class named Departments
class
Departments {
static
$Dept1
=
’CSE’
;
private
static
$Dept2
=
’ECE’
;
public
static
$Dept3
=
’EE’
;
}
// Using ReflectionClass over the Departments class
$ReflectionClass
=
new
ReflectionClass (
’Departments’
);
// Calling getStartLine() functions
$A
=
$ReflectionClass
-> getStartLine();
// Get the starting line number
// specified class
var_dump (
$A
);
?>
Output: int (4)
Link: https://www.php.net/manual/en/reflectionclass.getstartline.php