Use of string - exchange of variables

zhaozj2021-02-16  101

I want to exchange variables, but I don't want to use temporary variables.

List () and array () help you get it.

usage:

List ($ VAR1, $ VAR2) = Array ($ VAR2, $ VAR1);

?>

List () can not only exchange variables, but can also be used to handle arrays. Such as:

$ items = Array ("Linux", "Apache", "PHP", "MySQL");

RESET ($ item);

While (List (,% iTEM) = Each ($ items)) {

Print "$ item / N";

}

?>

转载请注明原文地址:https://www.9cbs.com/read-10637.html

New Post(0)