php - double checking if statement with is_file -


does valid? i'm still writing database coding want make sure i'm on right path won't have many errors when test.

$filechk1 = "../temp/files/" . $data[0] . ".doc"; $filechk2 = "../temp/files/" . $data[1] . ".doc";  if(is_file($filechk1) && is_file($filechk2)) {         $rec_type = "3";     } else if (!is_file($filechk1) && is_file($filechk2)) {         $rec_type = "2";     } else if (is_file($filechk1) && !is_file($filechk2)) {         $rec_type = "1";     } 

$is_file_1 = is_file($filechk1); $is_file_2 = is_file($filechk2);  if ($is_file_1)  {   $rec_type = $is_file_2 ? 3 : 1; } else {   if ($is_file_2) $rec_type = 2; } 

looks forget check if both file in-valid..


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -