New to PHP, need helps on Class and Function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dennislee85
Forum Newbie
Posts: 15
Joined: Mon Mar 12, 2007 9:16 pm

New to PHP, need helps on Class and Function

Post by dennislee85 »

Hi all,

I am new to PHP, i tried some simple codes on the class and function. But it is not running, those print statements before a class or function (or codes to invoke a class or function) are working well. I am using Apache2Triad1.4.4 on my standalone pc, supporting PHP4.4.2, PHP api = 20020903. Below is my simple codes, pls advise, thanks.

*** PLEASE USE PHP TAG FOR CODE BLOCKS ***

Code: Select all

<?php

	class Dog{

		function Dog(){

			print "Constructor invoked";
			
		}
		
		function _bark(){

			print "Woof!";
		}


	}

	$doggy = new Dog;
	$doggy->_bark();

	?>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

It is not clear from your post what is not running and what is working well. Perhaps you could post the output.
(#10850)
Post Reply