jaunty_mellifluous Posted December 3, 2010 Share Posted December 3, 2010 echo "bitches" . "<br />"; class classname { function _contruct($param) { echo "Contructor called with parameter ".$param; } } $a = new classname("First"); $b = new classname("Second"); I'm trying to run this code but it's not giving me any output. Output should be very simple, e.g, Constructor called with parameter First. Please help. Link to comment https://forums.phpfreaks.com/topic/220543-defining-simple-classes-to-take-parameters/ Share on other sites More sharing options...
OldWest Posted December 3, 2010 Share Posted December 3, 2010 construct was spelled wrong and you only had one underscore on __construct (needs two) Link to comment https://forums.phpfreaks.com/topic/220543-defining-simple-classes-to-take-parameters/#findComment-1142528 Share on other sites More sharing options...
jaunty_mellifluous Posted December 3, 2010 Author Share Posted December 3, 2010 Thanks. Yea, that's what I thought about the double underscore. They have a single one in the book I'm using. Must be a typo. Link to comment https://forums.phpfreaks.com/topic/220543-defining-simple-classes-to-take-parameters/#findComment-1142534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.