php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12630 BUG: cannot return
Submitted: 2001-08-07 13:54 UTC Modified: 2003-05-31 10:42 UTC
From: joustin at plusnet dot pl Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.0.6 OS: Red Hat Linux, Win2000 sp2
Private report: No CVE-ID: None
 [2001-08-07 13:54 UTC] joustin at plusnet dot pl
Hello!

This seems quite odd...
In the ...

      function() or dosomething;

...construct it seems that PHP only allows the usage of standard operators and functions in the place of "dosomething", so the 'return' doesn't work at all since it's a operator-like thingy.

The following snippet will produce a parse error:
----------------------

function test(){
    return false;
};

function test2(){
      test() or return;
}

----------------------

Thanks in advance for a quick fix :)

Keep up the good work!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-07 13:59 UTC] joustin at plusnet dot pl
Tested on Red Hat
 [2001-08-07 14:04 UTC] alindeman@php.net
this is not implemented in php

if you want to try something like that try...

if (!test())return;
 [2001-08-07 14:15 UTC] joustin at plusnet dot pl
BOGUS ?
The above is just a workaround... I've used it, though it's the only reasonable way to code some routines. But it's quite a LONG workaround and makes the code quite obfuscated and unclear... not mentioning possible performance losses.

Any plans to implement that ? (haven't seen the php source yet, but I could imagine that preety simple to implement)
 [2001-08-07 14:17 UTC] alindeman@php.net
I'll make this a feature request/change...
 [2003-05-31 10:42 UTC] andrey@php.net
Quite wierd.
Use the workaround.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC