User Tools

Site Tools


Action disabled: source
cs:php
Return to Home page

Table of Contents

PHP

Small guide about certain aspect of the PHP programming language

Data Structures

Arrays

In PHP arrays are associative. Keys can be integer or string, while values can be of any type.

// Define an associative array with two entries
$array = array("key1"=>"value1",
               "key2"=>"value2",);
 
// Cycle on array entry
foreach ($array as $key => $value){
  echo $key." ".$value." ".$array[$key]."\n";
}

Output:

key1 value1 value1
key2 value2 value2

If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/php?do=edit
/web/htdocs/www.skenz.it/home/data/pages/cs/php.txt · Last modified: 2024/04/08 22:34 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki
Privacy Policy