php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21119 Modified Control Structures
Submitted: 2002-12-20 13:01 UTC Modified: 2002-12-20 13:04 UTC
From: ericf at micgi dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.2.3 OS: NA
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: ericf at micgi dot com
New email:
PHP Version: OS:

 

 [2002-12-20 13:01 UTC] ericf at micgi dot com
Here's a suggestion that we(local developers in Carbondale,IL) all feel would improve usability of the control structures in PHP.

What if in this statement...
  if (($x == 'cats') && ($x == 'dogs') && ($x == 'birds')) {
we instead could say...
  if ($x IN 'cats','dogs','birds') {

This would reduce typing and allow you to compare lists(arrays) in your conditional statements without using array functions.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-20 13:04 UTC] derick@php.net
if (in_array($x, array ('cats', 'dogs', 'birds))) {

should be as useful as introducing a new construct.

Derick
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Fri Mar 27 04:00:02 2026 UTC