Created
October 21, 2010 04:36
-
-
Save koshiaaaaan/637942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 「a」という箱に「あ」が入ってる | |
$array['a'] = 'あ' ; | |
// 「b」という箱に「い」が入ってる | |
$array['b'] = 'い' ; | |
// 「c」という箱に「う」が入ってる | |
$array['c'] = 'う' ; | |
// 「い」 を表示したい時は「b」という箱を参照してやる | |
echo $array['b'] ; | |
// 全部表示するときは順番に中身を取り出してやる | |
// foreachを使うとそれが簡単に出来る。 | |
foreach( $array as $key => $value ) { | |
echo $key . ' : ' . $value . '<br />' ; | |
} | |
// a : あ | |
// b : い | |
// c : う | |
// と表示される。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment