php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #50208 Needs explicit statement on falling off the end of a function
Submitted: 2009-11-17 19:17 UTC Modified: 2009-11-23 21:02 UTC
From: mwood at IUPUI dot Edu Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
 [2009-11-17 19:17 UTC] mwood at IUPUI dot Edu
Description:
------------
There is no official statement of the meaning of exiting a function other than through a 'return' statement.  Specifically, it is possible to execute to the end of the function, but then what is the value of that invocation?

Reproduce code:
---------------
---
From manual page: language.functions
---

Not in "returning values" or "return()" either.  "Returning values" is probably the best place for it.

Expected result:
----------------
Since many other languages will use the value of the last expression evaluated as the return value of a function which does not explicitly 'return', it would be helpful to note prominently that PHP (apparently) does not do this.  It seems that the value of an invocation of such a function is NULL.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-23 21:01 UTC] svn@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&revision=291230
Log: Fixed bug#50208 (Needs explicit statement on falling off the end of a function)
 [2009-11-23 21:02 UTC] bjori@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 14:00:01 2026 UTC