UltraWebsiteHosting.comUltraWebsiteHosting.com
 

array_values

(PHP 4 )

array_values -- Return all the values of an array

Description

array array_values ( array input)

array_values() returns all the values from the input array.

Example 1. array_values() example

$array = array ("size" => "XL", "color" => "gold");
print_r(array_values ($array));

This will output:
Array
(
    [0] => XL
    [1] => gold
)

Note: This function was added to PHP 4, below is an implementation for those still using PHP 3.

Example 2. Implementation of array_values() for PHP 3 users

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

See also array_keys().



Go back to index



Have unlimited websites hosted for as low as $5.95 a month! Check out our new Hosting Plans!


Note: Documentation is made available for our clients. The application's homepage is located at PHP.net


 


All pages Copyright © 2002-2008 by Flux Services, Inc. All rights reserved.
All trademarks used are properties of their respective owners.
Refund Policy  Privacy Statement  Service Agreement


< >