php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33798 Inovoking Parent Constructor Does Work
Submitted: 2005-07-21 09:04 UTC Modified: 2005-07-21 10:16 UTC
From: localhost dot 80 at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.4 OS: Mac OSX 10.4 Tiger
Private report: No CVE-ID: None
 [2005-07-21 09:04 UTC] localhost dot 80 at gmail dot com
Description:
------------
Every Time a create a class and use a _construct()
to pass arguments it does not accept any


Reproduce code:
---------------
<?php
  class book{
    private $title;
    private $isbn;
    private $copies;
    public function _construct($isbn){
      $this->setIsbn($isbn);
      $this->getTitle();
      $this->getNumberCopies();
    }
    public function setIsbn($isbn){
      $this->isbn = $isbn;
    }
    public function getTitle(){
      $this->title = "Practical Python";
      print("Title: " . $this->title . "<br />");
    }
    
    public function getNumberCopies(){
      $this->copies = "5";
      print("Number copies available: " . $this->copies . "<br />");
    }
  }
  $book = new book("1590590066");
?>


Expected result:
----------------
Nothing

Actual result:
--------------
nothing

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-21 09:36 UTC] stochnagara at hotmail dot com
Use __construct instead of _construct
 [2005-07-21 10:16 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 21:01:33 2025 UTC