ID: 47221 Updated by: j...@php.net Reported By: sgnutzmann at yahoo dot de -Status: Open +Status: Feedback -Bug Type: Performance problem +Bug Type: Arrays related Operating System: Windows XP PHP Version: 5.2.8 New Comment:
Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. Previous Comments: ------------------------------------------------------------------------ [2009-01-26 17:58:51] sgnutzmann at yahoo dot de Description: ------------ I use the function array_diff() to compare two sorted string-arrays with numerical keys (array sizes are 76,906 and 433,959, string sizes in all array elements less than 20 characters). With PHP 5.2.4 the function returns very fast (just few seconds), with PHP 5.2.8 I kill PHP.exe after 30 minutes(!) without result. PHP.INI: memory_limit = 1536M extension=php_pdo.dll extension=php_zip.dll extension=php_pdo_odbc.dll Reproduce code: --------------- // $Sales and $Inv read previously from file system $idSales = array(); foreach ( $Sales as $i => $data ) $idSales[$i] = '#'.$data[2]; array_multisort ($idSales, $Sales); $idInv = array(); foreach ( $Inv as $i => $data ) $idInv[$i] = '#'.$data[1]; array_multisort ($idInv, $Inv); echo "Start array_diff\n"; $unknown = array_diff ( $idSales, $idInv ); echo "End array_diff\n"; Expected result: ---------------- see description Actual result: -------------- no result in 30 minutes ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47221&edit=1