php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9765 syntax request
Submitted: 2001-03-15 09:47 UTC Modified: 2002-04-27 15:05 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-03-15 09:47 UTC] fabiankessler at usa dot net
such a syntax would be nice:

if (getColor() == ['green'|'blue']) {
if (someFunction() != [true&null]) {
if (xy() >= [$x&$y]) {

which means

if ((getColor() == 'green') || (getColor() == 'blue')) {
but saves one call to the function
or

$myCol = getColor();
if (($myCol == 'green') || ($myCol == 'blue')) {
but looks better and saves a temp var.

$tmp = functionThatReturnsBool();
if ($tmp == true OR $tmp == null) {

sometimes it could be done with
if (in_array(getColor(), array('green', 'blue'))) { 
but not always.

fab

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-27 15:05 UTC] jimw@php.net
not going to happen.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC