공부하자/PHP

[PHP] 배열 초기화 하기

YoBot 2019. 1. 14. 12:36

[PHP] 배열 초기화 하기


unset('삭제할 배열');


사용예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
  $test = array(
      0 => array("id"=>"1""name"=>"Mike",    "num"=>"3321"),
      1 => array("id"=>"2""name"=>"test""num"=>"3123")
  );
 
  foreach ($test as $key => $value) {
    foreach ($value as $keys => $values) {
      echo $keys." ".$values."<BR>";
    }
  }
  unset( $test );
  if($test == null){
    echo "no arr";
  }
?>
cs


출력값 

id 1

name Mike
num 3321
id 2
name test
num 3123
no arr