$value){ $text = str_replace("_tK_{$key}_", $value, $text); } file_put_contents($destFilePath, $text); return true; } /** * '비교적' 안전한 int 변환 * null -> null * int -> int * float -> int * numeric(int, float) 포함 -> int * 기타 -> 예외처리 * * @return int|null */ function toInt($val, $force=false){ if($val === null){ return null; } if(is_int($val)){ return $val; } if(is_numeric($val)){ return intval($val);// } if($val === 'NULL' || $val === 'null'){ return null; } if($force){ return intval($val); } throw new InvalidArgumentException('올바르지 않은 타입형 :'.$val); }