Comunitatea PHP Romania
 

 
array_values

array_values

(PHP 4 , PHP 5)

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.

Exemplu 1. array_values() example

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

This will output:

Array
(
    [0] => XL
    [1] => gold
)

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

Exemplu 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().

Ultimele discutii in forum RSS Forum

Ultimele articole Ultimele articole

Newsletter


Email:
 inscriere
 renuntare
 
 Arhiva newsletter

Parteneriat

Copyright © 2001-2008 PHP Romania Add PHPRomania to Google Add PHPRomania to Del.icio.us Add PHPRomania to Stumbleupon Add PHPRomania to Yahoo! Add PHPRomania to Digg Add PHPRomania to Blink Mobile Phones | Shopping 2006 | Loan | eBay | Cheap DVDs
Ads: Partener Way2Web Nework: gazduire web | inregistrare domenii | web design | imobiliare | web hosting
Powered by Simplis