php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12116 Array_slice acts as array_splice
Submitted: 2001-07-12 17:37 UTC Modified: 2001-07-12 18:05 UTC
From: tom at fluxxx dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.0.6 OS: Win2k Server Advance/ IIS 5.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tom at fluxxx dot com
New email:
PHP Version: OS:

 

 [2001-07-12 17:37 UTC] tom at fluxxx dot com
//returns pear
$f=array("orange","apple","pear","banana");
$output=array_splice($f,2,1);
foreach($output as $d){
	echo $d."<BR>";
}

//also returns pear
$f=array("orange","apple","pear","banana");
$output=array_slice($f,2,1);
foreach($output as $d){
	echo $d."<BR>";
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-12 17:44 UTC] tom at fluxxx dot com
I misunderstood the functionality of array_slice and array_splice.  This behavior is as intended.
 [2001-07-12 18:05 UTC] derick@php.net
Not a bug, so bogus
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 05 04:01:35 2025 UTC