Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22996 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21909 invoked by uid 1010); 27 Apr 2006 19:31:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21894 invoked from network); 27 Apr 2006 19:31:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2006 19:31:56 -0000 X-PHP-List-Original-Sender: hannes.magnusson@gmail.com X-Host-Fingerprint: 66.249.82.199 xproxy.gmail.com Linux 2.4/2.6 Received: from ([66.249.82.199:39314] helo=xproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 38/BD-11022-B2C11544 for ; Thu, 27 Apr 2006 15:31:55 -0400 Received: by xproxy.gmail.com with SMTP id t14so1480502wxc for ; Thu, 27 Apr 2006 12:31:51 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WxBT85SRCUqr5KumZ/MOGpjpi6mNbuc4cVKXXtqnJnIHmjm5z9wjICMjVytJ2kYItS06P94aLq4dKhr5JbCMznH2PvVqjf1x9Y58jvu6HByv/8ZU5NZtSpBDEyeQc6jge7GYo7qPBhefJ0IDJpfWezdtJt23Tv8jY+pY7fcIFcs= Received: by 10.70.39.8 with SMTP id m8mr1447274wxm; Thu, 27 Apr 2006 12:31:48 -0700 (PDT) Received: by 10.70.15.13 with HTTP; Thu, 27 Apr 2006 12:31:48 -0700 (PDT) Message-ID: <7f3ed2c30604271231k2d962980g758c466a2b4929f7@mail.gmail.com> Date: Thu, 27 Apr 2006 21:31:48 +0200 To: xuefengal Cc: internals In-Reply-To: <200604280319293595716@sohu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200604280319293595716@sohu.com> Subject: Re: [PHP-DEV] about shuffle() From: hannes.magnusson@gmail.com ("Hannes Magnusson") Turn on E_STRICT. Read php.net/shuffle again. Read php.net/mailing-lists again. And at last, if you still have a problem, read http://bugs.php.net/how-to-report.php -Hannes On 4/27/06, xuefengal wrote: > hi,all > > i have a problem. > > try this code on win2003,iis6,php5.1.1(isapi) > ---------------------------------------- > function _1_2($n) { > $tmp = array(); > return shuffle($tmp = range(1,$n); > } > echo('
'.print_r(_1_2(8),True).'
'); > ---------------------------------------- > result > Array > ( > [0] => 6 > [1] => 3 > [2] => 7 > [3] => 4 > [4] => 8 > [5] => 2 > [6] => 1 > [7] => 5 > ) > ---------------------------------------- > after,try code on FreeBSD6.0r apache2.0.55,php5.1.2(cli) > result is > ---------------------------------------- > Array > ( > [0] => 1 > [1] => 2 > [2] => 3 > [3] => 4 > [4] => 5 > [5] => 6 > [6] => 7 > [7] => 8 > ) > ---------------------------------------- > > manual said [bool shuffle ( array &array )] > > modify code > ---------------------------------------- > function _1_2($n) { > $tmp = array(); > $tmp = range(1,$n); > return shuffle($tmp); > } > ---------------------------------------- > > it looks good. why on win2003,iis6 result is correct too. > > ---------------------------------------- > OS=Win2003 > IE Version=6.0.3790.1830 > E:\Inetpub\php>php -v > PHP 5.1.1 (cli) (built: Nov 27 2005 21:39:02) > Copyright (c) 1997-2005 The PHP Group > Zend Engine v2.1.0, Copyright (c) 1998-2005 Zend Technologies > ---------------------------------------- > [/home/htdocs/]%->uname -a > FreeBSD xfxy.org 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Sun Apr 9 17:54:38 UTC 2006 root@xxx:/usr/src/sys/i386/compile/devel i386 > [/home/htdocs/]%->php -v > PHP 5.1.2 (cli) (built: Apr 8 2006 20:29:15) > Copyright (c) 1997-2006 The PHP Group > Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies > [/home/htdocs/]%->httpd -v > Server version: Apache/2.0.55 > Server built: Apr 8 2006 18:41:44 > [/home/htdocs/]%-> > > > xuefengal >         xuefengal@sohu.com > 2006-04-28 >