PHP 锟叫的憋拷锟斤拷锟斤拷一锟斤拷锟斤拷元锟斤拷锟脚猴拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞撅拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷执锟叫⌒达拷摹锟�
锟斤拷锟斤拷锟斤拷锟斤拷 PHP 锟斤拷锟斤拷锟斤拷锟侥憋拷签一锟斤拷锟斤拷循锟斤拷同锟侥癸拷锟斤拷一锟斤拷锟斤拷效锟侥憋拷锟斤拷锟斤拷锟斤拷锟斤拷母锟斤拷锟斤拷锟铰伙拷锟竭匡拷头锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥革拷锟斤拷锟斤拷郑锟斤拷锟斤拷锟斤拷禄锟斤拷摺锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿拷锟�'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'锟斤拷
Note: 锟节达拷锟斤拷说锟斤拷锟斤拷母锟斤拷 a-z锟斤拷A-Z锟斤拷锟皆硷拷 ASCII 锟街凤拷锟斤拷 127 锟斤拷 255锟斤拷0x7f-0xff锟斤拷锟斤拷
Note: $this 锟斤拷一锟斤拷锟斤拷锟斤拷谋锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷鼙锟斤拷锟街碉拷锟�
锟斤拷渭锟�锟矫伙拷锟秸硷拷锟斤拷锟斤拷指锟斤拷锟斤拷
锟叫关憋拷锟斤拷锟侥猴拷锟斤拷锟斤拷息锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
<?php
$var = 'Bob';
$Var = 'Joe';
echo "$var, $Var"; // 锟斤拷锟� "Bob, Joe"
$4site = 'not yet'; // 锟角凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街匡拷头
$_4site = 'not yet'; // 锟较凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟铰伙拷锟竭匡拷头
$i站锟斤拷is = 'mansikka'; // 锟较凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
?>
锟斤拷锟斤拷默锟斤拷锟斤拷锟角达拷值锟斤拷值锟斤拷锟斤拷也锟斤拷锟斤拷说锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟绞斤拷锟街碉拷锟斤拷锟揭伙拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟皆硷拷锟斤拷式锟斤拷值锟斤拷锟斤拷值锟斤拷目锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿讹拷牛锟斤拷锟斤拷纾拷锟揭伙拷锟斤拷锟斤拷锟斤拷锟街碉拷锟斤拷锟斤拷锟斤拷锟揭伙拷锟斤拷锟斤拷锟绞憋拷锟斤拷谋锟斤拷锟斤拷锟揭伙拷锟斤拷锟斤拷锟斤拷锟街碉拷锟斤拷锟斤拷锟斤拷锟接帮拷斓斤拷锟斤拷锟揭伙拷锟斤拷锟斤拷锟斤拷锟斤拷泄锟斤拷锟斤拷锟斤拷锟斤拷偷母锟街碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞�一锟铰★拷
PHP 也锟结供锟斤拷锟斤拷锟斤拷一锟街凤拷式锟斤拷锟斤拷锟斤拷锟斤拷值锟斤拷锟斤拷锟矫革拷值锟斤拷锟斤拷锟斤拷味锟斤拷锟铰的憋拷锟斤拷锟津单碉拷锟斤拷锟矫o拷锟斤拷锟斤拷之锟斤拷"锟斤拷为锟斤拷锟斤拷锟�" 锟斤拷锟斤拷 "指锟斤拷"锟斤拷锟斤拷原始锟斤拷锟斤拷锟斤拷锟侥讹拷锟铰的憋拷锟斤拷锟斤拷影锟届到原始锟斤拷锟斤拷锟斤拷锟斤拷之锟斤拷然锟斤拷
使锟斤拷锟斤拷锟矫革拷值锟斤拷锟津单地斤拷一锟斤拷 & 锟斤拷锟脚加碉拷锟斤拷要锟斤拷值锟侥憋拷锟斤拷前锟斤拷源锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟界,锟斤拷锟叫达拷锟斤拷片锟较斤拷锟斤拷锟�"My name is Bob"锟斤拷锟轿o拷
<?php
$foo = 'Bob'; // 锟斤拷 'Bob' 锟斤拷锟斤拷 $foo
$bar = &$foo; // 通锟斤拷 $bar 锟斤拷锟斤拷 $foo
$bar = "My name is $bar"; // 锟睫革拷 $bar 锟斤拷锟斤拷
echo $bar;
echo $foo; // $foo 锟斤拷值也锟斤拷锟睫革拷
?>
锟斤拷一锟斤拷锟斤拷要锟斤拷锟斤拷锟斤拷锟街革拷锟斤拷锟斤拷蔷锟斤拷锟街伙拷锟斤拷锟斤拷锟斤拷值谋锟斤拷锟斤拷趴锟斤拷锟斤拷锟斤拷酶锟街碉拷锟�
<?php
$foo = 25;
$bar = &$foo; // 锟较凤拷锟侥革拷值
$bar = &(24 * 7); // 锟角凤拷; 锟斤拷锟斤拷没锟斤拷锟斤拷锟街的憋拷锟绞�
function test()
{
return 25;
}
$bar = &test(); // 锟角凤拷
?>
锟斤拷然锟斤拷 PHP 锟叫诧拷锟斤拷锟斤拷要锟斤拷始锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆憋拷锟斤拷锟斤拷锟叫筹拷始锟斤拷锟角革拷锟斤拷习锟竭★拷未锟斤拷始锟斤拷锟侥憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟酵碉拷默锟斤拷值 - 锟斤拷锟斤拷锟斤拷锟酵的憋拷锟斤拷默锟斤拷值锟斤拷
FALSE
锟斤拷锟斤拷锟轿和革拷锟斤拷锟酵憋拷锟斤拷默锟斤拷值锟斤拷锟姐,锟街凤拷锟斤拷锟酵憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 echo
锟叫o拷默锟斤拷值锟角匡拷锟街凤拷锟斤拷锟皆硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥拷锟街碉拷强锟斤拷锟斤拷椤�
Example #1 未锟斤拷始锟斤拷锟斤拷锟斤拷锟斤拷默锟斤拷值
<?php
// Unset AND unreferenced (no use context) variable; outputs NULL
var_dump($unset_var);
// Boolean usage; outputs 'false' (See ternary operators for more on this syntax)
echo($unset_bool ? "true\n" : "false\n");
// String usage; outputs 'string(3) "abc"'
$unset_str .= 'abc';
var_dump($unset_str);
// Integer usage; outputs 'int(25)'
$unset_int += 25; // 0 + 25 => 25
var_dump($unset_int);
// Float/double usage; outputs 'float(1.25)'
$unset_float += 1.25;
var_dump($unset_float);
// Array usage; outputs array(1) { [3]=> string(3) "def" }
$unset_arr[3] = "def"; // array() + array(3 => "def") => array(3 => "def")
var_dump($unset_arr);
// Object usage; creates new stdClass object (see http://www.php.net/manual/en/reserved.classes.php)
// Outputs: object(stdClass)#1 (1) { ["foo"]=> string(3) "bar" }
$unset_obj->foo = 'bar';
var_dump($unset_obj);
?>
锟斤拷锟斤拷未锟斤拷始锟斤拷锟斤拷锟斤拷锟斤拷默锟斤拷值锟斤拷某些锟斤拷锟斤拷禄锟斤拷锟斤拷锟斤拷猓拷锟斤拷锟斤拷一锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷之锟斤拷时锟斤拷锟斤拷锟斤拷同锟侥憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟� register_globals 锟斤拷锟斤拷一锟斤拷锟斤拷要锟斤拷锟斤拷全锟斤拷锟斤拷锟斤拷使锟斤拷未锟斤拷始锟斤拷锟侥憋拷锟斤拷锟结发锟斤拷 E_NOTICE 锟斤拷锟襟,碉拷锟斤拷锟斤拷锟斤拷一锟斤拷未锟斤拷始锟斤拷锟斤拷锟斤拷锟介附锟接碉拷元时锟斤拷锟结。isset() 锟斤拷锟皆结构锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟揭伙拷锟斤拷锟斤拷锟斤拷欠锟斤拷驯锟斤拷锟绞硷拷锟斤拷锟�