Content deleted Content added
m link type inference using Find link |
Update code and link. |
||
Line 774:
<source lang=PHP>
$phonebook = array
$phonebook['Sally Smart'] = '555-9999';
$phonebook['John Doe'] = '555-1212';
$phonebook['J. Random Hacker'] = '555-1337';
// or
$phonebook = array
);
// or
$phonebook['contacts']['Sally Smart']['number'] = '555-9999';▼
$phonebook['contacts']['
$phonebook['contacts']['J. Random Hacker']['number'] = '555-1337';
</source>
Line 796 ⟶ 797:
<source lang=PHP>
foreach
}
// For the last array example it is used like this
foreach($phonebook['contacts'] as $name => $num) {
echo 'Name: ', $name, ', number: ', $num['number'], "\n";
}
</source>
Line 810 ⟶ 809:
PHP has an [http://php.net/array extensive set of functions] to operate on arrays.
If you want an associative array that can use objects as keys instead of strings and integers, you can use the [http://
===Pike===
|