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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fabiankessler at usa dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-27 15:05 UTC] jimw@php.net
not going to happen.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 20:01:46 2025 UTC