codescracker


php

PHP Member Function



« Previous Tutorial Next Tutorial »


Member functions in PHP are those functions which are defined inside the class and are used to access the object data.

PHP Member Function Example

Here is an example that demonstrates member function in PHP.

<!DOCTYPE html>
<html>
<head>
	<title>Member Function Example in PHP</title>
</head>
<body>
<?php
	class Myclass 
	{
		// here the function, member_function
		// can be called as member function
		function member_function()
		{
			echo "I am in member function";
		}
	}
	// now create object of above defined class
	$object_Myclass = new Myclass;
	// now access member function using object of the class
	$object_Myclass::member_function();
?>
</body>
</html>

The above member function example code in PHP will produce the output that is given here:

php member function

« Previous Tutorial Next Tutorial »




Tools
Calculator

Quick Links
Signup - Login - Give Online Test