php class 入面既 var 同 public

var 同 public有咩分別,作用係d咩?

function a ($1)如果我用a()可唔可以係$1呢個變數係array?
姐係例如
$abc = array(
'1' = 'a',
'2' = 'b',
'3' = 'c'
);
function def ($ghi){
foreach ($ghi as $value){
   echo $value.'.<br />.';
}
}
def ($abc );

仲有想問foreach ($ghi as $value)同foreach ($ghi as &$value)有咩分別?foreach ($ghi as as $key => $value)既 =>又代表咩?

請教路

var 同 public有咩分別,作用係d咩?

function a ($1)如果我用a()可唔可以係$1呢個變數係array?
姐係例如
$a ...
Mr.K 發表於 2010-4-26 16:20



    先睇呢版, 唔明再問.
http://hk.php.net/manual/en/control-structures.foreach.php

TOP

回復 2# little_keung


    呢個我睇過好多次

TOP

回復  little_keung


    呢個我睇過好多次
Mr.K 發表於 2010-4-26 19:33



    你緊係唔明啦.

    有 example 唔抄, D syntax 打錯晒, 梗係唔明啦.

    拎住個 example 做下 exercise ,   咁會明得更心刻.

    睇完 manual 邊到唔明先再問.

TOP

本帖最後由 kau 於 2010-4-26 23:23 編輯

Ans to Q1: http://www.php.net/manual/en/language.oop5.php
                               --> http://www.php.net/manual/en/language.oop5.properties.php
                               --> http://www.php.net/manual/en/language.oop5.visibility.php
Ans to Q2: http://www.php.net/manual/en/language.types.array.php
Ans to Q3: http://www.php.net/manual/en/language.references.php

Do experiments! they are free to try!

TOP

本帖最後由 travel 於 2010-4-27 11:17 編輯

oops,打錯

TOP

你緊係唔明啦.

    有 example 唔抄, D syntax 打錯晒, 梗係唔明啦.

    拎住個 example 做下 exe ...
little_keung 發表於 2010-4-26 21:22


查實強哥你都好客氣,hoho

TOP