Hướng dẫn is used to delete a variable in php? - được sử dụng để xóa một biến trong 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.

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ố

var

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

vars

Các biến tiếp theo.

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

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

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ụ

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

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

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

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

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

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

(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

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

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

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ú

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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ú

// 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

// 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

// 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

// 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

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

// 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

// 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

// 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

// 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

// 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

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

(unset)1

(unset)2

(unset)3

(unset)4

(unset)5

(unset)6

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.

Không thể tháo gỡ 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)8

(unset)9

vars8

(unset)1

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.

Không thể tháo gỡ 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

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

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

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

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

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

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

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

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

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

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

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

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ú

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

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

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

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

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

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

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ú

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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ú

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Chad 0x40 Herballure 0x2e com ¶

15 năm trước

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

Tigercat tại Aol Dot Com ¶

10 năm trước

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

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

vars8

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

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

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

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

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

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

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

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

vars8

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

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

8 tháng trước

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

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

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

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

Chức năng nào được sử dụng để xóa biến?

Hàm unset () giải quyết một biến.unset() function unsets a variable.

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

Biến biến trong PHP là gì?

Một biến có thể lấy giá trị của một biến và coi đó là tên của một biến.Trong ví dụ trên, Hello, có thể được sử dụng làm tên của một biến bằng cách sử dụng hai dấu hiệu đô la.tức là $$ a = 'thế giới';?>takes the value of a variable and treats that as the name of a variable. In the above example, hello, can be used as the name of a variable by using two dollar signs. i.e. $$a = 'world'; ?>

Strval trong PHP là gì?

Hàm strval () là hàm sẵn có trong PHP và được sử dụng để chuyển đổi bất kỳ giá trị vô hướng nào (chuỗi, số nguyên hoặc gấp đôi) thành một chuỗi.Chúng ta không thể sử dụng strval () trên các mảng hoặc trên đối tượng, nếu được áp dụng thì hàm này chỉ trả về tên loại của giá trị được chuyển đổi.Cú pháp: Strval ($ biến)used to convert any scalar value (string, integer, or double) to a string. We cannot use strval() on arrays or on object, if applied then this function only returns the type name of the value being converted. Syntax: strval( $variable )