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
 [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: Tue Jul 29 21:00:03 2025 UTC