PHP
  • Introduction
  • PHPMailer
  • UploadFile
  • PHP link MySQL to insert
  • rand功能
  • Create GUID by random
  • Coding problem
  • PHP+MySQL樹狀圖
  • JWT(Json Web Token)
  • 小功能
    • array_push
    • array_chunk
  • 遞迴
  • 生成json
  • 註解方式
  • Call API
  • google url shortener
  • 身分證字號驗證
  • google maps api 取兩點路線規劃的距離
  • 兩點座標的直線距離
  • 將傳入的陣列重新根據某個欄位做排序
  • 抓取最準的IP,從近到遠做判斷
  • 利用curl推播ios,用ios的token
  • 在local端onServer
Powered by GitBook
On this page
  1. 小功能

array_push

Previous小功能Nextarray_chunk

Last updated 5 years ago

Was this helpful?

CtrlK

Was this helpful?

用來將值一個一個的丟到陣列裡面,可以用迴圈去跑

格式:array_push( $array , $value );

$android = [];
$ios = [];
foreach($mdIdArray as $val){

    $data = $sat_r->getGcmIdByMdID($val);
    if(count($data) == 0 || is_null($data)){
        return false;
    }
    if($data->mur_systemtype == 0){
        array_push($android,$data['mur_gcmid']);
    }
    if($data->mur_systemtype == 1){
        array_push($ios,$data['mur_gcmid']);
    }
}