<?php
$a = 3;
echo 'typeof $a is : ' . gettype($a) . "\n"; // integer
$b = &$a;
echo 'typeof $b es : ' . gettype($b) . "\n"; // integer
$c = new stdClass;
$c->name = "charles";
$b = $c;
$b->name = "bill";
echo '$c->name : ' . $c->name . "\n";
echo 'typeof $b es : ' . gettype($b) . "\n";
echo 'typeof $a is : ' . gettype($a) . "\n"; // object
echo 'The value of $a is : ' . $a->name; // bill
?>
輸出:
typeof $a is : integer
typeof $b is : integer
$c->name : bill
typeof $b is : object
typeof $a is : object
The value of $a is : bill
你可以發佈你的代碼的輸出嗎? – GWW 2011-03-11 15:47:09
您的代碼有語法錯誤。 – 2011-03-11 15:48:46
輸出:http://ideone.com/R2Ii6 – fredley 2011-03-11 15:49:19