php / php/php-src

Explode from end with negative limit

Open
#13,074 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

I would find more consistent explode if negative limit will return N parts from the end like positive limit does from start. For limitting the actual additional param should be added. This will be consistent with other functions with negative limit.

repro: https://3v4l.org/u9WM3

Array
(
    [0] => a
    [1] => b-c-d
)
Array
(
    [0] => a-b-c
    [1] => d
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PHP explode behavior shown in the issue and compare the positive and negative limit cases using the linked 3v4l.org reproduction. Determine the intended API for limiting from the end and add coverage demonstrating the expected result before assessing the interpreter change.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.