php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51373 remove or change the 'function' in classes
Submitted: 2010-03-23 22:46 UTC Modified: 2010-03-23 23:05 UTC
From: kjarli at gmail dot com Assigned:
Status: Wont fix Package: Unknown/Other Function
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
49 - 30 = ?
Subscribe to this entry?

 
 [2010-03-23 22:46 UTC] kjarli at gmail dot com
Description:
------------
The function keyword is pretty deprecated in php atm. If you got a function inside 
a class people always refer to it as a 'method' and not a function. Besides that, 
there is actually no need for that keyword... 
class foo {
  public function foobar() {}
}
Is actually the same as:

class foo {
  public foobar() {}
}

Should not be hard to understand that it's a function or method...

I propose to either change the keyword to method or remove it completely

Test script:
---------------
<?php
class foo {
  // old
  public function foobar() {}

  // suggestion 0
  public method foobar() {}

  // suggestion 1
  public foobar() {}
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-23 23:05 UTC] derick@php.net
-Status: Open +Status: Wont fix
 [2010-03-23 23:05 UTC] derick@php.net
functions are by far not deprecated. OO might be useful, but is definitely not what all PHP really cares for. I don't see why we would want to change this. It doesn't add functionality, nor does it add to readability. IMO, changing this would be a strange thing to do.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC