例1
代碼如下 復制代碼foreach($list as &$value){
if(isOnline($value['uid'])){
$value['sid'] = '1';
}else{
$value['sid'] = '0';
}
$value['likes']='1';
$sql="SELECT uid,likes,flower FROM ".DB::table("dmember_member_count")." WHERE uid='".$value['uid']."'";
$fff = DB::query($sql);
$ffff = DB::fetch($fff);
//print_r($ffff);
$value['flower']=$ffff['flower'];
$value['likes']=$ffff['likes'];
}
例子 2,array_push() 函數
代碼如下 復制代碼<?php
$a=array("Dog","Cat");
array_push($a,"Horse","Bird");
print_r($a);
?>
輸出:
Array ( [0] => Dog [1] => Cat [2] => Horse [3] => Bird )
例子 3
帶有字符串鍵的數組:
<?php
$a=array("a"=>"Dog","b"=>"Cat");
array_push($a,"Horse","Bird");
print_r($a);
?>
輸出:
Array ( [a] => Dog [b] => Cat [0] => Horse [1] => Bird )