由于不理解,就一個(gè)勁的測試,得出以下結(jié)果:一、標(biāo)量變量解析實(shí)例:
<?php
$a=5;
$b=5.5;
$c=true;
$d=false;
$e=null;
$f='Hello world!';
echo "$a $b $c $d $e $f";
echo "<br/>{$a} {$b} {$c} {$d} {$e} {$f}";
echo "<br/>${a} $ ${c} $nhkv1sx5v02o ${e} ${f}";
?>
二、數(shù)組單元解析實(shí)例一:
<?php
$arr=['green','a'=>'blue'];
echo "$arr[0] $arr[a]";
echo "<br/>{$arr[0]} {$arr['a']}";
?>
實(shí)例二:
<?php
$arr=[['green','a'=>'blue'],'x'=>['green','a'=>'blue']];
echo "{$arr[0][0]} {$arr[0]['a']} {$arr['x'][0]} {$arr['x']['a']}";
?>
三、對象成員解析實(shí)例一:
<?php
class A{
var $test='red';
}
$obj = new A;
echo "$obj->test";
echo "<br/>{$obj->test}";
?>
實(shí)例二:
<?php
class A{
var $test=['green','a'=>'blue'];
}
$obj = new A;
echo "{$obj->test[0]} {$obj->test['a']}";
?>
實(shí)例三:
<?php
class A{
function test1(){return 'red';}
function test2(){return ['green','a'=>'blue'];}
}
$obj = new A;
echo "{$obj->test1()} {$obj->test2()[0]} {$obj->test2()['a']}";
?>
像字符串中表示對象的成員常量、對象的靜態(tài)成員,我都不會(huì)。雖然測試了一些表示形式,但我根本就不理解,請指教
- 2 回答
- 0 關(guān)注
- 384 瀏覽
添加回答
舉報(bào)
0/150
提交
取消