dennislee85 Posted March 13, 2007 Share Posted March 13, 2007 Hi all, I am new to php. Currently i have tried some simple coding. I tried to code some simple class and function in php. Yet it does not running. Those print statement before the class coding are shown. I am using Apache2Triad1.4.4, supporting php 4.4.2, php API version 20020903. Below is my sample codes, Please advise. <?php class Dog{ function Dog(){ print "Constructor invoked"; } function _bark(){ print "Woof!"; } } $doggy = new Dog; $doggy->_bark(); ?> Thanks alot Link to comment https://forums.phpfreaks.com/topic/42446-code-not-running-when-comes-to-class-or-function/ Share on other sites More sharing options...
vbnullchar Posted March 13, 2007 Share Posted March 13, 2007 i test it on php5 it prints "Constructor invokedWoof!" Link to comment https://forums.phpfreaks.com/topic/42446-code-not-running-when-comes-to-class-or-function/#findComment-205939 Share on other sites More sharing options...
dennislee85 Posted March 13, 2007 Author Share Posted March 13, 2007 O? Is this mean that my Apache server problem? Link to comment https://forums.phpfreaks.com/topic/42446-code-not-running-when-comes-to-class-or-function/#findComment-205942 Share on other sites More sharing options...
emehrkay Posted March 13, 2007 Share Posted March 13, 2007 i dont see any issues with your code maybe you can change the _bark to just bark and do new Dog(); Link to comment https://forums.phpfreaks.com/topic/42446-code-not-running-when-comes-to-class-or-function/#findComment-205943 Share on other sites More sharing options...
redarrow Posted March 13, 2007 Share Posted March 13, 2007 what i get m8 X-Powered-By: PHP/5.2.0 Content-type: text/html Constructor invokedWoof! Link to comment https://forums.phpfreaks.com/topic/42446-code-not-running-when-comes-to-class-or-function/#findComment-205964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.