setlocale

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Set locale information
<?php setlocale(int $category, string $locales, string ...$rest): string|false
<?php     #[DataProvider('collectionClassProvider')]

    public function testSortByMany($collection)

    {

        $defaultLocale = setlocale(LC_ALL, 0);



        $data = new $collection([['item' => '1'], ['item' => '10'], ['item' => 5], ['item' => 20]]);

        $expected = $data->pluck('item')->toArray();
<?php         $data = $data->sortBy(['item'], SORT_LOCALE_STRING);

        $this->assertEquals($data->pluck('item')->toArray(), $expected);



        setlocale(LC_ALL, 'de_DE');



        sort($expected, SORT_LOCALE_STRING);

        $data = $data->sortBy(['item'], SORT_LOCALE_STRING);
<?php         $data = $data->sortBy(['item'], SORT_LOCALE_STRING);

        $this->assertEquals($data->pluck('item')->toArray(), $expected);



        setlocale(LC_ALL, $defaultLocale);

    }



    #[DataProvider('collectionClassProvider')]
<?php         setlocale(LC_TIME, $site->locale());
<?php     {




        setlocale(LC_ALL, 'de_DE');



        $submission = Form::make('test')->makeSubmission();
<?php         $this->assertStringNotContainsString(',', $submission->id());



        setlocale(LC_ALL, 'en_US');

    }

}
<?php         $this->decimalPoint = localeconv();

        $this->decimalPoint = $this->decimalPoint['decimal_point'];



        if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) {

            setlocale(\LC_NUMERIC, 'C');

        }
<?php         $this->decimalPoint = $this->decimalPoint['decimal_point'];



        if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) {

            setlocale(\LC_NUMERIC, 'C');

        }



        if ($returnDump = true === $output) {
<?php                 $this->setOutput($prevOutput);

            }

            if ($locale) {

                setlocale(\LC_NUMERIC, $locale);

            }

        }