摘要:
sex = $v; } //魔术方法set function __set($n,$v) { if($n=="age") { if($v>=18 && $v$n = $v; } } else { $this->$n = $v; } } //魔术方法get function __get($n) { return $this->$... 阅读全文
摘要:
"p001","name"=>"张三"); //二维数组 $attr = array( array(), rray() ); //数组遍历 //for循环遍历 for($i=0;$i$v) { $k;$v; } $attr = array(1,2,3,4,5,2); foreach($attr as $k=>$v) { if($v==3) { unset($attr[$k... 阅读全文
摘要:
101,"name"=>"张三","sex"=>"男"); print_r($attr); echo $attr["name"]; //遍历数组 $attr = array("aa","bb","cc","dd"); //1.for循环遍历,只能遍历索引数组 for($i=0;$i"; }*/ //2.foreach遍历,关联索引都支持 /*foreach($attr as $v) { ... 阅读全文