Bug #64164 [NEW]: array_slice function
From: ajaydixxit at gmail dot com
Operating system: redhat enterprises 6
PHP version: 5.3.21
Package: Arrays related
Bug Type: Bug
Bug description:array_slice function
Description:
------------
---
From manual page:
http://www.php.net/function.array-slice#refsect1-function.array-slice-description
---
I declared an array "my_array" with different offset value.
In my case its offset value is 1. So my_array[0] is not defined. Now when I
After that, i used the predefined function array_slice. In array_slice i
entered 1 and 3 as the offset value and required length value. Now as print
the sliced array, it should display:
shiva hanu bhrama
but what i am experiencing is :
vishnu shiva hanu.
It seems like that the array_slice function is not aware of the offset
value change in the array.
Test script:
---------------
<?php
$my_array = array( 1 => "vishnu" , "shiva" , "hanu" ,
"bhrama" );
print_r($my_array);
echo $my_array[0]; // this is coming undefined //
$slice = array_slice($my_array,1,3);
print_r($slice);
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=64164&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64164&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64164&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64164&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64164&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64164&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64164&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64164&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64164&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64164&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64164&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64164&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64164&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64164&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64164&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64164&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64164&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64164&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64164&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64164&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64164&r=mysqlcfg
Thread (2 messages)
- ajaydixxit at gmail dot com