php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #10483 someFunction() OR break;
Submitted: 2001-04-24 22:17 UTC Modified: 2001-04-25 05:27 UTC
From: fabiankessler at usa dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4 OS: all
Private report: No CVE-ID: None
 [2001-04-24 22:17 UTC] fabiankessler at usa dot net
why is the syntax
someFunction() OR anotherFunction();
only possible with a function on the right side of the OR? cause it has to return something? 
would be nice to be able to to someFunction() OR break;

example:

$success = FALSE;
do { // try block
  doSomething("foo") OR break;
  doSomething("bar") OR break;
  doSomething("hello") OR break;
  doSomething("world") OR break;
  $success = TRUE;
} while (FALSE);
echo ($success) ? 'yes' : 'no';

greetings
fab

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-25 05:27 UTC] hholzgra@php.net
thats because 'break' is a keyword, not a function 

break as a languag construct has no value
and may not be used in expressions

btw: the same holds true for 'if', 'for', ...

you cannot say 

  doSomething("...") OR if(...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 13:01:27 2024 UTC