Created
June 17, 2013 07:48
-
-
Save sugarHoge/5795265 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
$test03=array( | |
array('111', '222'), | |
array('333', '444') | |
); | |
foreach ($test03 as $key1 =>$val1) { | |
foreach ($val1 as $key2 => $val2) { | |
debug($key2 . "=>" . $val2); | |
} | |
} | |
/* | |
debug: 0=>Array | |
debug: 0=>111 | |
debug: 1=>222 | |
debug: 1=>Array | |
debug: 0=>333 | |
debug: 1=>444 | |
*/ |
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
$test01[]='aaa'; | |
$test01[]='bbb'; | |
foreach ($test01 as $key => $val) { | |
debug($key . "=>" . $test01[$key]); | |
debug($key . "=>" . $val); | |
} | |
/* | |
debug: 0=>aaa content.js:73 | |
debug: 0=>aaa content.js:73 | |
debug: 1=>bbb content.js:73 | |
debug: 1=>bbb | |
*/ | |
$test02=array('ccc','ddd'); | |
foreach ($test02 as $key => $val) { | |
debug($key . "=>" . $val); | |
} | |
/* | |
debug: 0=>ccc | |
debug: 1=>ddd | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment