Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Pipelining
- DS
- system
- Class
- MacOS
- react
- Java
- Linux
- Algorithm
- javascript
- function
- web
- DB
- XML
- CSS
- while
- data structure
- DoM
- python
- architecture
- MIPS
- DATAPATH
- mysql
- computer
- github
- instruction
- html
- for
- php
- control
Archives
- Today
- Total
YYYEJI
[PHP] PHP의 다차원 Array 본문
728x90
Array란?
맵(map)으로 이루어진, 순서가 있는 집합을 의미합니다.
↓↓↓ 1차원 Array 공부하기 ↓↓↓
https://yyyeji.tistory.com/303
기본적은 문법은 아래와 같습니다.
$nums = array(
array("One", " : ", 1),
array("Two", " : ", 2),
array("Three", " : ", 3)
);
기본적은 출력은 아래와 같습니다.
<!EOCTYPE html>
<body>
<h1>My first PHP page</h1>
<?php
$nums = array(
array("One", " : ", 1),
array("Two", " : ", 2),
array("Three", " : ", 3)
);
echo $nums[0][0].$nums[0][1].$nums[0][2]."<br>";
echo $nums[1][0].$nums[1][1].$nums[1][2]."<br>";
echo $nums[2][0].$nums[2][1].$nums[2][2];
?>
</body>
For statement를 이용한 출력은 아래와 같습니다.
<!EOCTYPE html>
<body>
<h1>My first PHP page</h1>
<?php
$nums = array(
array("One", " : ", 1),
array("Two", " : ", 2),
array("Three", " : ", 3)
);
for ($row = 0; $row<3; $row++){
for($col = 0; $col<3; $col++) {
echo $nums[$row][$col]." ";
}
echo "<br>";
}
?>
</body>
◡̈
'HTML(or XML) & CSS & JavaScript' 카테고리의 다른 글
[PHP] Super Globals 란? (0) | 2022.12.12 |
---|---|
[PHP] PHP의 Associative Array (0) | 2022.12.12 |
[PHP] PHP의 1차원 Array (0) | 2022.12.12 |
[PHP] 함수 만들기 (0) | 2022.12.12 |
[PHP] Class 만들기 (0) | 2022.12.12 |