LoginSignup
0
0

More than 5 years have passed since last update.

in_array();の覚書

Last updated at Posted at 2017-06-14

twitter風システムの構築を勉強してて色々と悩んだところなのでメモ

in_array.php
$sql = 'SELECT文';
$rows = get_array($link,$sql);//配列取得のユーザ関数

$in = array();//空の配列
$i = 0;
foreach($rows as $value){
    $in[] = $value[$key];
}

foreach($rows as $value){
    if(in_array($rows[$i]['user_id'],$in)){
        //$rowsのuser_idが$inにあればここの処理
    }else{
        //なければこちらの処理
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0