Skip to content

Match with && operator #10971

@Tagliatti

Description

@Tagliatti

Description

Why do expressions match with && or || operator behave like the example? What is the reason for returning false?

The following code: https://3v4l.org/KktKB#v8.2.4

<?php

$result = match('test') {
    'test' && true => true,
    'test2' && true => true,
    default => false,
};

var_dump($result);

Resulted in this output:

bool(false)

But I expected this output instead:

bool(true)

PHP Version

8.2

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions