_construct() problem

From: Date: Wed, 08 Jun 2005 21:23:22 +0000
Subject: _construct() problem
Groups: php.general 
Request: Send a blank email to php-general+get-216707@lists.php.net to get a copy of this message
Hello, I designed a "player" class with the following properties and constructor: class player { private $properties = array('firstname' => NULL, 'lastname' => NULL); function _construct($first, $last) { $this->properties['firstname'] = $first; $this->properties['lastname'] = $last; } } Then I have other methods that allow me to set and get the properties. However, when I issue a: $myplayer = new player('Laurent', 'Blanc'); it seems that the constructor is not taken into account: the properties are not initialized. I have to explicitly initialize them with the setter methods in order for the initialization to take place. What did I do wrong? I am running PHP 5.0.4 with Apache 2.0.54 on Fedora Core 1. Stéphane

« previous php.general (#216707) next »