Hướng dẫn unset and set in php - bỏ thiết lập và đặt trong php

tôi cân gi

  • Tôi cần giữ lại các giá trị mảng sau khi mở chúng trước.

Đây là cấu trúc mảng (trước khi mở)

    [0] => Array
    (
        [currency] => INR
    )

   [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )

Đây là cấu trúc mảng (sau khi mở)

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )

Đây là mã PHP

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
  • Tôi cần tiền tệ để được đưa vào một mảng khác
  • Đầu tiên tôi không đặt giá trị mảng [tiền tệ] từ mảng.
  • Sau đó, tôi muốn [tiền tệ] được đặt vào một mảng khác.
  • Làm thế nào tôi có thể đặt giá trị sau khi Unset từ Array.

Hỏi ngày 20 tháng 10 năm 2014 lúc 7:12Oct 20, 2014 at 7:12

Hướng dẫn unset and set in php - bỏ thiết lập và đặt trong php

1

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);

Đã trả lời ngày 20 tháng 10 năm 2014 lúc 7:18Oct 20, 2014 at 7:18

Hướng dẫn unset and set in php - bỏ thiết lập và đặt trong php

Noufalcepnoufalcenoufalcep

3.34015 Huy hiệu vàng32 Huy hiệu bạc48 Huy hiệu đồng15 gold badges32 silver badges48 bronze badges

0

Bạn cần nhận được giá trị tiền tệ trước khi mở nó trong mảng mới. Nếu bạn mở ra và sau đó bạn cố gắng truy cập nó thì nó sẽ gây ra cho không xác địnhundefined

Cố gắng như thế này:

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now

Đã trả lời ngày 20 tháng 10 năm 2014 lúc 7:15Oct 20, 2014 at 7:15

Hướng dẫn unset and set in php - bỏ thiết lập và đặt trong php

Awlad Litonawlad LittonAwlad Liton

9.2682 Huy hiệu vàng26 Huy hiệu bạc52 Huy hiệu Đồng2 gold badges26 silver badges52 bronze badges

(Php 4, Php 5, Php 7, Php 8)

Unset - Und đặt một biến đã choUnset a given variable

Sự mô tả

Hành vi của unset () bên trong một hàm có thể thay đổi tùy thuộc vào loại biến bạn đang cố gắng phá hủy.unset() inside of a function can vary depending on what type of variable you are attempting to destroy.

Nếu một biến toàn cầu hóa không được đặt () bên trong một hàm, chỉ có biến cục bộ bị phá hủy. Biến trong môi trường gọi sẽ giữ lại giá trị giống như trước khi unset () được gọi.unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was called.

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>

Ví dụ trên sẽ xuất ra:

Để giải quyết () một biến toàn cầu bên trong hàm, sau đó sử dụng mảng $ globals để làm như vậy:unset() a global variable inside of a function, then use the $GLOBALS array to do so:

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>

Nếu một biến được truyền bởi tham chiếu là unset () bên trong một hàm, chỉ có biến cục bộ bị phá hủy. Biến trong môi trường gọi sẽ giữ lại giá trị giống như trước khi unset () được gọi.unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was called.

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>

Ví dụ trên sẽ xuất ra:

Để giải quyết () một biến toàn cầu bên trong hàm, sau đó sử dụng mảng $ globals để làm như vậy:unset() inside of a function, unset() destroys the variable only in the context of the rest of a function. Following calls will restore the previous value of a variable.

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>

Ví dụ trên sẽ xuất ra:

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23

Để giải quyết () một biến toàn cầu bên trong hàm, sau đó sử dụng mảng $ globals để làm như vậy:

Nếu một biến được truyền bởi tham chiếu là unset () bên trong một hàm, chỉ có biến cục bộ bị phá hủy. Biến trong môi trường gọi sẽ giữ lại giá trị giống như trước khi unset () được gọi.

Nếu một biến tĩnh không được đặt () bên trong hàm, unSet () sẽ tiêu diệt biến chỉ trong bối cảnh phần còn lại của hàm. Các cuộc gọi sau đây sẽ khôi phục giá trị trước đó của một biến.

Thông số

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
0

Biến không được đặt.

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
1

Các biến tiếp theo.

Trả về giá trịunset() example

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
2

Không có giá trị được trả về.

Ví dụunset() function.

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
3 casting serves only as a
    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
6-type cast, for completeness. It does not alter the variable it's casting. The (unset) cast is deprecated as of PHP 7.2.0, removed as of 8.0.0.

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
7

Ví dụ trên sẽ xuất ra:

Để giải quyết () một biến toàn cầu bên trong hàm, sau đó sử dụng mảng $ globals để làm như vậy:

Nếu một biến được truyền bởi tham chiếu là unset () bên trong một hàm, chỉ có biến cục bộ bị phá hủy. Biến trong môi trường gọi sẽ giữ lại giá trị giống như trước khi unset () được gọi.: Because this is a language construct and not a function, it cannot be called using variable functions, or named arguments.

Nếu một biến tĩnh không được đặt () bên trong hàm, unSet () sẽ tiêu diệt biến chỉ trong bối cảnh phần còn lại của hàm. Các cuộc gọi sau đây sẽ khôi phục giá trị trước đó của một biến.:

Thông số

Nếu một biến tĩnh không được đặt () bên trong hàm, unSet () sẽ tiêu diệt biến chỉ trong bối cảnh phần còn lại của hàm. Các cuộc gọi sau đây sẽ khôi phục giá trị trước đó của một biến.:

Thông số

Nếu một biến tĩnh không được đặt () bên trong hàm, unSet () sẽ tiêu diệt biến chỉ trong bối cảnh phần còn lại của hàm. Các cuộc gọi sau đây sẽ khôi phục giá trị trước đó của một biến.:

Thông sốunset() on inaccessible object properties, the __unset() overloading method will be called, if declared.

[1] => Array ( [type] => General Public Tickets Adult [amount] => 50 [comment] => (Working Days) ) [2] => Array ( [type] => General Public Tickets Adult [amount] => 80 [comment] => (Saturday/ Sunday/ Holiday) ) 0

  • Biến không được đặt.
  •     [1] => Array
        (
            [type] => General Public Tickets  Adult
            [amount] => 50
            [comment] => (Working Days)
        )
       [2] => Array
        (
            [type] => General Public Tickets  Adult
            [amount] => 80
            [comment] => (Saturday/ Sunday/ Holiday)
        )
    
    1
  • __unset()
  • Các biến tiếp theo.
  • Trả về giá trị

Không có giá trị được trả về.

Ví dụ

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
9

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
0

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
1

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
2

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Ví dụ #1 unset () ví dụ

Ví dụ #2 sử dụng

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
3 đúc

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
4

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
5

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
6

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
7

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
8

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
3 Pha đúc thường bị nhầm lẫn với hàm Und ().
    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
3 Đúc chỉ phục vụ như một diễn viên ____ 16 loại, để hoàn thiện. Nó không làm thay đổi biến mà nó đúc. Diễn viên (UnST) được không dùng nữa là Php 7.2.0, được loại bỏ là 8.0.0.

Ví dụ #2 sử dụng

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
3 đúc

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
9

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);
0

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
3 Pha đúc thường bị nhầm lẫn với hàm Und ().
    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
3 Đúc chỉ phục vụ như một diễn viên ____ 16 loại, để hoàn thiện. Nó không làm thay đổi biến mà nó đúc. Diễn viên (UnST) được không dùng nữa là Php 7.2.0, được loại bỏ là 8.0.0.

Ghi chú

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);
2

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);
3

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);
4

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);
5

Lưu ý: Bởi vì đây là một cấu trúc ngôn ngữ và không phải là một hàm, nó không thể được gọi là sử dụng các hàm biến hoặc các đối số được đặt tên.

Ghi chú:

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);
6

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);
7

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Có thể giải phóng các thuộc tính đối tượng có thể nhìn thấy trong bối cảnh hiện tại.

Không thể bỏ

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
8 bên trong một phương thức đối tượng.

//save element to a new variable
$temp = $data[0];

//unset element
unset($data[0]);

/* code to set the value after unset */

//add element back to the array
$data[0] = $temp;
        OR
//To add elements to the beginning of an array, use array_unshift
array_unshift($data,$temp);
9

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now
0

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now
1

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now
2

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now
3

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Khi sử dụng unset () trên các thuộc tính đối tượng không thể truy cập, phương thức quá tải __unset () sẽ được gọi, nếu được khai báo.

Xem thêm

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now
5

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now
6

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now
7

             $arrNew = $data[0];  //save it new array
              unset($data[0]); //unset it now
8

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

ISSET () - Xác định xem một biến được khai báo và khác với NULL

Không thể bỏ

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
8 bên trong một phương thức đối tượng.

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
0

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
1

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
2

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
3

Khi sử dụng unset () trên các thuộc tính đối tượng không thể truy cập, phương thức quá tải __unset () sẽ được gọi, nếu được khai báo.

Xem thêm

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
4

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
5

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
6

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
7

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
8

Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
9

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
0

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
1

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
2

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
3

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
4

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
5

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
6

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
7

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
8

function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
9

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

ISSET () - Xác định xem một biến được khai báo và khác với NULL

Ghi chú:

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
1

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
2

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
3

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
4

Có thể giải phóng các thuộc tính đối tượng có thể nhìn thấy trong bối cảnh hiện tại.

Ghi chú

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
5

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
6

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
7

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
8

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
9

Lưu ý: Bởi vì đây là một cấu trúc ngôn ngữ và không phải là một hàm, nó không thể được gọi là sử dụng các hàm biến hoặc các đối số được đặt tên.

Ghi chú:

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
0

Có thể giải phóng các thuộc tính đối tượng có thể nhìn thấy trong bối cảnh hiện tại.

Xem thêm

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
1

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
2

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
7

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
4

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
5

ISSET () - Xác định xem một biến được khai báo và khác với NULL

trống () - Xác định xem một biến có trống không

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
6

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
7

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
8

function foo(&$bar
{
    unset(
$bar);
    
$bar "blah";
}
$bar 'something';
echo 
"$bar\n";foo($bar);
echo 
"$bar\n";
?>
9

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>
0

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>
1

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Array_Splice () - Xóa một phần của mảng và thay thế nó bằng một thứ khác

Ghi chú:

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>
3

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>
4

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
3

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>
6

Có thể giải phóng các thuộc tính đối tượng có thể nhìn thấy trong bối cảnh hiện tại.

Không thể bỏ

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
8 bên trong một phương thức đối tượng.

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>
7

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>
8

function foo()
{
    static 
$bar;
    
$bar++;
    echo 
"Before unset: $bar, ";
    unset(
$bar);
    
$bar 23;
    echo 
"after unset: $bar\n";
}
foo();
foo();
foo();
?>
9

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
00

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
01

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
02

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
03

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
04

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
05

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
06

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
07

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
08

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
09

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
10

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
11

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
12

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Pauljamescampbell tại Gmail Dot Com ¶

14 năm trước

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
14

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
15

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Ẩn danh ¶

12 năm trước

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
17

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
18

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Warheog tại Warhog Dot Net

18 năm trước

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
20

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
21

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
22

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Edouard Dot Berge tại Gmail Dot Com ¶

12 năm trước

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
24

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
25

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
26

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
27

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Warheog tại Warhog Dot Net

18 năm trước

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
29

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
30

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
31

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
32

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Edouard Dot Berge tại Gmail Dot Com ¶

dibakar dot datta tại gmail dot com ¶

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
34

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
35

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

16 năm trước

14 năm trước

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
37

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
38

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
39

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
40

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
41

Hayley Watson ¶

12 năm trước

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
42

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
43

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
44

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
45

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
46

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
47

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
48

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
49

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
50

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
51

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
52

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
53

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
54

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Warheog tại Warhog Dot Net

18 năm trước

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
56

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
57

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
7

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
59

Edouard Dot Berge tại Gmail Dot Com ¶

dibakar dot datta tại gmail dot com ¶

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
60

16 năm trước

Hayley Watson ¶

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
61

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
62

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
3

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
64

15 năm trước

Stacionari tại Gmail Dot Com ¶

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
65

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
66

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
67

Andreas ¶

macnimble tại gmail dot com

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
68

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
69

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
70

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
71

function foo() 
{
    unset(
$GLOBALS['bar']);
}
$bar "something";
foo();
?>
3

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
73

13 năm trước

Chad 0x40 Herballure 0x2e com ¶

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
74

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
75

    [1] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 50
        [comment] => (Working Days)
    )
   [2] => Array
    (
        [type] => General Public Tickets  Adult
        [amount] => 80
        [comment] => (Saturday/ Sunday/ Holiday)
    )
76

                   unset($data[0]);
                 /* code to set the value after unset */
                   $data= array_values($data[0]);
3

Đặt và mở khóa trong PHP là gì?

Về cơ bản, nó kiểm tra xem một biến hoặc chỉ mục có tồn tại hay không. PHP tạo thông báo nếu bạn nghĩ rằng một biến tồn tại trong khi thực sự nó không phải là. Bằng cách sử dụng chức năng PHP ISSET, bạn có thể tránh mọi thông báo không mong muốn. Hàm Untet của PHP được sử dụng để phá hủy một biến nhất định.checks whether a variables or index exists or not. PHP generates notice if you think a variable exists while actually it is not. By using the PHP isset function, you may avoid any unwanted notices. The unset function of PHP is used to destroy a given variable.

Chức năng Untet trong PHP là gì?

unset () phá hủy các biến được chỉ định.Hành vi của unset () bên trong một hàm có thể thay đổi tùy thuộc vào loại biến bạn đang cố gắng phá hủy.Nếu một biến toàn cầu hóa không được đặt () bên trong một hàm, chỉ có biến cục bộ bị phá hủy.destroys the specified variables. The behavior of unset() inside of a function can vary depending on what type of variable you are attempting to destroy. If a globalized variable is unset() inside of a function, only the local variable is destroyed.

Sự khác biệt giữa unset () và thiếu liên kết () là gì?

Hàm hủy liên kết () được sử dụng khi bạn muốn xóa hoàn toàn các tệp. Hàm unset () được sử dụng khi bạn muốn làm cho tệp đó trống. The unset() Function is used when you want to make that file empty.

Mảng uns đặt trong PHP là gì?

Hàm Untet được sử dụng để phá hủy bất kỳ biến nào khác và cùng cách sử dụng để xóa bất kỳ yếu tố nào của mảng.Lệnh Untet này lấy phím mảng làm đầu vào và loại bỏ phần tử đó khỏi mảng.Sau khi loại bỏ khóa và giá trị liên quan không thay đổi.used to destroy any other variable and same way use to delete any element of an array. This unset command takes the array key as input and removed that element from the array. After removal the associated key and value does not change.