Edit report at https://bugs.php.net/bug.php?id=55366&edit=1
ID: 55366 User updated by: gorshang at gmail dot com Reported by: gorshang at gmail dot com -Summary: keys lost when replace an array +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: keys lost when using substr_replace replace an array Previous Comments: ------------------------------------------------------------------------ [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