function file_output($file_path, $mime = null, $file_name = null) { if (empty($file_name)) { $file_name = substr_after($file_path, '/'); } header('Content-type: ' . $mime); header('Content-Disposition: attachment; filename="' . $file_name . '"'); header('Content-Transfer-Encoding: binary'); // header('Content-Length: '.filesize(DIR.$summary_pdf)); header('Accept-Ranges: bytes'); ob_clean(); flush(); readfile($file_path); }
function custom_number($num, $sep = ',') { $i = 0; $post_decimal = substr_after($num, '.', false, true); $num = substr_before($num, '.'); $num = (string) $num; $strlen = strlen($num) - 1; for ($n = $strlen; $n > -1; $n--) { $string = ($i > 0 and $i % 3 == 0) ? $num[$n] . $sep . $string : $num[$n] . $string; $i++; } if (!empty($post_decimal)) { $string .= '.' . $post_decimal; } return $string; }