From:             trosos at atlas dot cz
Operating system: 
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  array_values function documentation issue

Description:
------------
Some translations (cz) of the documentation for array_values() gives an
example of implementation of array_values for PHP 3 users.

This is wrong.

The correct example may be:

<?php

function array_values ($arr) {
   $t = array();
   while (list($k, $v) = each ($arr)) {
       $t[] = $v;
 /* */  }  /* */
   return $t;
}

?>

Reproduce code:
---------------
<?php

function array_values ($arr) {
   $t = array();
   while (list($k, $v) = each ($arr)) {
       $t[] = $v;
       return $t;
   }
}

var_dump (array_values (array ('a','b')));

?>

Expected result:
----------------
array(2) {
  [0]=>
  string(1) "a"
  [1]=>
  string(1) "b"
}

Actual result:
--------------
array(1) {
  [0]=>
  string(1) "a"
}

-- 
Edit bug report at http://bugs.php.net/?id=29024&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29024&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29024&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29024&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29024&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29024&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29024&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29024&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29024&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29024&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29024&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29024&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29024&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29024&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29024&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29024&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29024&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29024&r=float

Reply via email to