Skip to content

version_compare() comparing 8.5 and 8.5.0 doesn't work #20706

@staabm

Description

@staabm

Description

The following code:

<?php

var_dump(version_compare("8.5.0", "8.5.0", "<="));
var_dump(version_compare("8.5.0", "8.5", "<="));

Resulted in this output:

bool(true)
bool(false)

But I expected this output instead:

bool(true)
bool(true)

see https://3v4l.org/8UfAW#veol

PHP Version

PHP 8.4.15 (cli) (built: Nov 18 2025 17:26:05) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.4.15, Copyright (c) Zend Technologies

Operating System

macOS

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