HOME IRC
gelignite
Promotion
Nutzloses Wissen
Deine IP:
13.58.197.26

Dein Host:
ec2-13-58-197-26.us-east-2.compute.amazonaws.com

Seitenaufbau dauerte:


Aktuelle Uhrzeit (UTC):
19-04-2024 18:24:56

Letzten Lottozahlen [?]:
9, 16, 34, 37, 40, 47
SZ: 2
Tipps und Tricks
zurück

Code Snippet - Pick an associative array's first element (PHP)


Direct link:
Tips und Tricks #6
Bezug:
PHP (Zend)

Details:
It is often asked how to pick the first element (key, value) of an associative array in PHP. Here are three ways to do so:
<?php
// The sample array
$array = array( "z" => "a""x" => "b""y" => "c" );

/*******************************************************************
 * EITHER ...
 *******************************************************************/
// Reset internal pointer to the begin
reset$array );

// Get key ...
$key key$array );

// ... and value
$value current$array );

/*******************************************************************
 * ... OR ...
 *******************************************************************/
// Slice array's first element
$first array_slice$array01true );

// Get key ...
$key key$first );

// ... and value
$value current$first );

/*******************************************************************
 * ... AND ALSO ...
 *******************************************************************/
// Get key ...
$key array_shiftarray_keys$array ));

// ... and value
$value array_shiftarray_values$array ));
?>
Letzte Meldungen
13.08.2011 - Counter-Strike GO ...[more]

10.04.2011 - Monday Night Combat ...[more]

25.02.2011 - Humorvolles ...[more]

23.01.2011 - 1.5 GHz, 3 GB Speicher, ... ...[more]

20.01.2011 - Liste der QuakeNet Achievements und wie man sie bekommt bereitgestellt ...[more]

31.12.2010 - Guten Rutsch ...[more]

16.12.2010 - gelignAIte - Official Release ...[more]

11.11.2010 - openTTD AI ...[more]

26.10.2010 - Zeitreisen scheinen möglich ...[more]

04.09.2010 - Abschaltung "index.php4" ...[more]

Umfrage
Lieber ATI oder NVidia?

Legal notes
© 2000 - 2021 The Black Eagle Eyes, Alle Rechte vorbehalten