php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33068 Function declarations outside class struct
Submitted: 2005-05-19 17:07 UTC Modified: 2010-12-22 03:41 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: john dot kraal at rse dot nl Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.0.4 OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: john dot kraal at rse dot nl
New email:
PHP Version: OS:

 

 [2005-05-19 17:07 UTC] john dot kraal at rse dot nl
Description:
------------
It would be nice to have a C++ Style function declaration for classes like this:

class example
{
  var $blah;

  function __construct()
  {
    $this->blah = 'test';
  }
}

function example::returnBlah()
{
  return $this->blah;
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-19 17:08 UTC] john dot kraal at rse dot nl
changed my email.
 [2010-12-22 03:41 UTC] johannes@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-12-22 03:41 UTC] johannes@php.net
In C++ you'd have to add the declaration to the class and the separation is needed for properly separating the implementation from the interface. In PHP a more java-like approach was chosen.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 30 10:00:02 2025 UTC