Hướng dẫn unset($_get variable php) - unset ($ _ get biến php)

(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.

<?php
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:

<?php
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.

<?php
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.

<?php
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ố

var

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

vars

Các biến tiếp theo.

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

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>

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

Ví dụunset() function. (unset) casting serves only as a <?php
function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
1-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.

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

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.

var

  • Biến không được đặt.
  • vars
  • __unset()
  • Các biến tiếp theo.
  • Trả về giá trị

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

Ví dụ

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

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

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

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

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

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

Ví dụ #2 sử dụng (unset) đúc

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

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

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

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

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

(unset) Pha đúc thường bị nhầm lẫn với hàm Und (). (unset) đúc chỉ phục vụ như một diễn viên ____ 11 loại, cho sự hoàn chỉnh. 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 (unset) đúc

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

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

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

(unset) Pha đúc thường bị nhầm lẫn với hàm Und (). (unset) đúc chỉ phục vụ như một diễn viên ____ 11 loại, cho sự hoàn chỉnh. 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ú

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

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

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

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

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ú:

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

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

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

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ể tháo gỡ <?php
function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
3 bên trong một phương thức đối tượng.

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

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

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

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

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

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

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

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

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

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

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

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

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

Không thể tháo gỡ <?php
function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
3 bên trong một phương thức đối tượng.

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

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

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

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

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

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

var0

var1

var2

var3

var4

var5

var6

var7

var8

var9

vars0

vars1

vars2

vars3

vars4

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

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

Ghi chú:

vars6

vars7

vars8

vars9

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ú

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
0

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
1

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
2

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
3

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
4

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ú:

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
5

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

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
6

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
7

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
2

<?php
// destroy a single variable
unset($foo);// destroy a single element of an array
unset($bar['quux']);// destroy more than one variable
unset($foo1$foo2$foo3);
?>
9

(unset)0

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

(unset)1

(unset)2

(unset)3

(unset)4

(unset)5

(unset)6

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

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ú:

(unset)8

(unset)9

vars8

(unset)1

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ể tháo gỡ <?php
function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
3 bên trong một phương thức đối tượng.

(unset)2

(unset)3

(unset)4

(unset)5

(unset)6

(unset)7

(unset)8

(unset)9

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

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

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

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

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

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

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

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

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

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.

Ví dụ #2 sử dụng (unset) đúc

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

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

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

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ú

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

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

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

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.

Không thể tháo gỡ <?php
function destroy_foo() 
{
    global 
$foo;
    unset(
$foo);
}
$foo 'bar';
destroy_foo();
echo 
$foo;
?>
3 bên trong một phương thức đối tượng.

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

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

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

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

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.

Ghi chú

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

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

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

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

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

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ú:

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

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

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

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

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

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

Xem thêm

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

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

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

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

Ví dụ #2 sử dụng (unset) đúc

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

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

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

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

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

(unset) Pha đúc thường bị nhầm lẫn với hàm Und (). (unset) đúc chỉ phục vụ như một diễn viên ____ 11 loại, cho sự hoàn chỉnh. 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ú

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

13 năm trước

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

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

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

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

Chad 0x40 Herballure 0x2e com ¶

15 năm trước

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

Tigercat tại Aol Dot Com ¶

9 năm trước

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

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

vars8

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

Muhamad_zakaria tại Yahoo Dot Com ¶

17 năm trước

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

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

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

Magiê dot oxit dot play+php tại gmail dot com ¶

8 năm trước

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

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

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

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

vars8

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

ray.paseur đôi khi sử dụng gmail ¶

6 tháng trước

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

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

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

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