Edit report at https://bugs.php.net/bug.php?id=55366&edit=1

 ID:                 55366
 Patch added by:     ar...@php.net
 Reported by:        gorshang at gmail dot com
 Summary:            keys lost when using substr_replace replace an array
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   win7
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

The following patch has been added/updated:

Patch Name: php-trunk-substr_replace-array-keys
Revision:   1312537507
URL:        
https://bugs.php.net/patch-display.php?bug=55366&patch=php-trunk-substr_replace-array-keys&revision=1312537507


Previous Comments:
------------------------------------------------------------------------
[2011-08-05 02:51:15] gorshang at gmail dot com

keys lost when using substr_replace replace an array

------------------------------------------------------------------------
[2011-08-05 02:33:15] gorshang at gmail dot com

Description:
------------
---
>From manual page: http://www.php.net/function.substr-replace%23Changelog
---
My version is 5.3.5.
But the keys lost when replace an array.
I wan't write more, but I can't. 
Oh, my poor English.
I'm Chinese.
Tank you.


Test script:
---------------
<?php

$arr = array('abc'=>'llsskdkk','def'=>'llsskjkkdd');
$newarr = substr_replace($arr, 'zzz', 0, -2);

print_r($newarr);

?>

Expected result:
----------------
Array
(
    [abc] => zzzkk
    [def] => zzzdd
)

Actual result:
--------------
Array
(
    [0] => zzzkk
    [1] => zzzdd
)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55366&edit=1

Reply via email to