php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #29024 array_values function documentation issue
Submitted: 2004-07-05 22:40 UTC Modified: 2004-07-07 16:33 UTC
From: trosos at atlas dot cz Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: trosos at atlas dot cz
New email:
PHP Version: OS:

 

 [2004-07-05 22:40 UTC] trosos at atlas dot cz
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"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-05 23:54 UTC] nlopess@php.net
English docs are fine. The Czech translation team will update the file when they have some time.

Thanks,
Nuno
 [2004-07-07 16:33 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

(Left bogus as it is translation problem.)
 [2017-05-26 22:43 UTC] 55953 dot kt at gmail dot com
I have a problem and it is been bugging me so hard!

the array_value function does not work at !

This is the input array.

$register_data = [
			'firstname' 	=> $_POST['firstname'],
			'middlename' 	=> $_POST['middlename'],
			'lastname' 		=> $_POST['lastname'],
			'dob' 			=> $_POST['dob'],
			'gender' 		=> $_POST['gender'],
			'school' 		=> $_POST['school'],
			'email'			=> $_POST['email']
		];

echo '<pre>', print_r(array_value($register_data)),'<pre>'; die();



i am not any output!!!
 Can you tell me what's going on?

I will be very glad to hear from you.

thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC