preg_split does not split multiple delimiters

preg_split does not split multiple delimiters

I'm trying to split a simple string by multiple delimiters, but get an unexpected result.

I'm trying to split a simple string by multiple delimiters, but get an unexpected result.

Consider the following string: "1_10_10-Einzel.pdf"

Using this call to preg_split:

$cut = preg_split("/[_\-\.]/", "1_10_10-Einzel.pdf", PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
print_r($cut);

I expect the following output:

Array
(
    [0] => 1
    [1] => 10
    [2] => 10
    [3] => Einzel
    [4] => pdf
)

, but actually what I get is this:

Array
(
    [0] => 1
    [1] => 10
    [2] => 10-Einzel.pdf
)

I played around a little bit with parentheses, flags and of course different regexes, but I don't get the expected behaviour. I also tried some completely different examples from stackOverflow, but also got a wrong result. Do I miss something?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

PHP Interview Questions with Solutions: Prepare for PHP Interview

Prepare for PHP Interviews. Set Variable With php.ini File. Logic & Output Behind PHP Code Segment. Class Concept, Error & Functions in PHP. Start PHP Now!

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[https://www.dataeximit.com/php-development-services/](https://www.dataeximit.com/php-development-services/ "https://www.dataeximit.com/php-development-services/"), we at Data EximIT have...

Advantages of Hiring PHP Developer for your Website Project

PHP - Hypertext pre-processor, a scripting language used by many people in developing web pages, but most of us are unaware even of the full form. To train someone and make them learn this whole language is as difficult and time-consuming as it is...