在PHP中,变量赋值的方法有以下几种:
$name = "John";
$name1 = "John";
$name2 = &$name1;
$var = "name";
$$var = "John";
$colors = array("red", "green", "blue");
class Person {
public $name;
}
$person = new Person();
$person->name = "John";
$name = null;
这些是PHP中常用的变量赋值方法,根据不同的需求和场景,可以选择适合的方法来赋值给变量。