Skip to content

Collection method unique() does not differentiate the strings '0' and '00' #14449

Closed
@kristofvandam

Description

@kristofvandam

With following example I expected to get both arrays back. Only got the first one with 'prefix' => '0'

$collect = collect(
[
    [
        'prefix' => '0',
        'trunk'  => 'A'
    ],[
        'prefix' => '00',
        'trunk'  => 'B'
    ]
]);

var_dump($collect->unique('prefix'));

I expected that because they are both Strings and therefore should be different.

Nice regards
Kristof

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions