Req #78822 [Opn->Fbk]: Returning from multiple function calls
| From: | requinix@php.net | Date: | Sat, 16 Nov 2019 01:35:53 +0000 |
| Subject: | Req #78822 [Opn->Fbk]: Returning from multiple function calls | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223740@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78822&edit=1
ID: 78822
Updated by: requinix@php.net
Reported by: mail-roboczy-dla-forow at wp dot pl
Summary: Returning from multiple function calls
-Status: Open
+Status: Feedback
Type: Feature/Change Request
-Package: PHP Language Specification
+Package: *General Issues
Operating System: All
PHP Version: Next Minor Version
Block user comment: N
Private report: N
New Comment:
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2019-11-16 01:34:41] mail-roboczy-dla-forow at wp dot pl
Description:
------------
function analyze($anyParameter)
{
foreach($anyParameter as &$v)
b($v);
}
function b(&$obj)
{
foreach($obj as $line)
{
$res=c($line);
}
if(...)
{
...
$res=b(substr($line,3)); /* recurrent function */
...
}
...
}
function c(&$line)
{
if($line=='1')
return 3;
if($line=='2')
return 4;
if($line=='unexpected data')
[analyze] return false; /* return from previous calls
and return 'false' from
'analyze' function and
continue execution from
next instruction after
last 'analyze' call. */
return -1;
}
Test script:
---------------
No test script, the functionality will help faster return from multiple calls, for example analyzing
jpeg, gif or odt files. It is the common situation that the analyzing function identyify unexpected
data and the analysis must by broken due to nonsense data and returns error code.
It is possible to write code without this enhancement but the code will be longer and will contain
additional conditions slowing execution of multiple nested calls.
Expected result:
----------------
additional syntax
[functionName] return result;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78822&edit=1