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?

php regex

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers? **[Hire Dedicated PHP Developer](https://hourlydeveloper.io/hire-dedicated-php-developer/ "Hire Dedicated PHP Developer")**, who can convert your idea to reality, within the stipulated...

Country State City Dropdown list in PHP MySQL PHP

Country state city dropdown using ajax in php. You'll learn how to populate country city state dropdown based on previous selection in php using ajax

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...

How to use highchart in php with example

Here, i will let you know that how to use highchart in php application with example. Highchart provides feature to draw different type of charts.

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...