謝晒的PHP網頁設計
聯絡E-mail:
sean0704@gmail.com
站內搜尋
Thursday, April 21, 2016
[PHP][JavaScript] 用 "=" 賦值時,PHP是複製(copy)物件,JS是參照(reference)物件。
JS:
var $a = ['a','b','c'];
var $b = $a;
$b[1] = 'x';
alert($a[1]); //印出x
PHP:
$a = array('a','b','c');
$b = $a;
$b[1] = 'x';
echo $a[1]; //印出b
No comments:
Post a Comment
Newer Post
Older Post
Home
View mobile version
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment