|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #52129 Easy substr/array_splice method
Submitted: 2010-06-20 21:39 UTC Modified: 2018-04-08 15:07 UTC
Avg. Score:2.0 ± 1.0
Reproduced:0 of 1 (0.0%)
From: david71rj at gmail dot com Assigned:
Status: Suspended Package: Strings related
PHP Version: 5.3.2 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: david71rj at gmail dot com
New email:
PHP Version: OS:


 [2010-06-20 21:39 UTC] david71rj at gmail dot com
In python exists a easy method for substr, and I suggest this for PHP. I think 
that not will do incompatible nothing because is a new method.

$test = "Hello";
echo $test[0]; // Exists: H
echo $test[0, 1; // New: H (too)
echo $test[-1]; // New: o
echo $test[-3]; // New: llo

$test = array(0, 1, 2);
echo $test[0]; // 0
echo $test[0, 2]; // array(0, 1, 2)

In python is [x:y], but in PHP I thinkg think that is better ',' to don't 



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-07 16:29 UTC]
Just for the record: that's called *slicing* in Python.
 [2018-04-08 15:07 UTC]
-Status: Open +Status: Suspended
 [2018-04-08 15:07 UTC]
Because this feature would require to change the syntax of PHP, it
would require the RFC process[1].  Anybody is welcome to start it!
For the time being, I'm suspending this ticket.

[1] <>
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon May 20 17:01:26 2019 UTC