首页 \ 问答 \ intdiv()未按预期工作(intdiv() is not working as expected)

intdiv()未按预期工作(intdiv() is not working as expected)

我正在使用这个功能,但结果不像预期的那样

function getyearly($monthly, $yearly)
    {
        if(!empty($monthly) && $monthly!='0' && !empty($yearly) && $yearly!='0')
        {
            $permonth = intdiv((int)$yearly, 12);
            $monthlytoyear = (int)$monthly*12;
            $aftersub = $monthlytoyear - (int)$yearly;
            $afterdiv = intdiv((int)$aftersub, (int)$yearly);
            // $finaly = (int)$afterdiv*100;
            return "$ " . $yearly . "/year ($" . round($permonth) . "/month; save ~" . (int)$afterdiv . "%)";
        } else {
            return '$ '.$yearly.'/yearly';
        }
    }

我得到零( 0 )。


I am using this function but result not coming as expected

function getyearly($monthly, $yearly)
    {
        if(!empty($monthly) && $monthly!='0' && !empty($yearly) && $yearly!='0')
        {
            $permonth = intdiv((int)$yearly, 12);
            $monthlytoyear = (int)$monthly*12;
            $aftersub = $monthlytoyear - (int)$yearly;
            $afterdiv = intdiv((int)$aftersub, (int)$yearly);
            // $finaly = (int)$afterdiv*100;
            return "$ " . $yearly . "/year ($" . round($permonth) . "/month; save ~" . (int)$afterdiv . "%)";
        } else {
            return '$ '.$yearly.'/yearly';
        }
    }

I am getting zero(0).


原文:https://stackoverflow.com/questions/50456925
更新时间:2023-01-22 17:01

最满意答案

我从扩展的ftp-simple文档中看到有一个选项:

confirm - 布尔 - (选项)只保存选项。 保存文件时,询问是否要覆盖该文件,如果该文件已存在。默认值:true

所以

"confirm" : false,

应该消除你所看到的警告/验证。


I see from the extension's ftp-simple documentation there is an option :

confirm - boolean - (option) Only save option. When you save the file, ask if you want to overwrite the file if it already exists.. Default: true

So

"confirm" : false,

should eliminate the warning/verification you see.

相关问答

更多
  • 仅编辑后台页面脚本时,无需重新加载整个扩展。 只需按下F5键即可打开devtools并重新加载背景页面。 至于后台页面的编程调用, chrome.developerPrivate.openDevTools将在Chrome应用程序和扩展程序开发人员工具应用程序中展示。 从理论上讲,您可以创建自己的简单应用程序(使用10行代码)重新加载扩展并重新打开其后台页面。 它需要将app id列入白名单,我不确定它是否适用于这种特殊情况(即使白名单帮助删除了安装时显示的权限错误,我的快速测试最终也失败了)。 When e ...
  • 这似乎我需要新的眼睛:/在路径名中很难看到错字(l而不是i)... It's seems I need new eyes :/ There was a hard to see typo (l instead of i) in path name...
  • VCL旨在为菜单项提供快捷方式优先级。 但是,当ActiveControl为TCustomEdit(调用撤消等)时,您可以编写项目单击处理程序(或操作执行处理程序)以执行一些特殊处理。 编辑:我知道您不喜欢在代码中的许多地方处理所有可能的特殊情况(所有菜单项或操作处理程序)。 我担心我不能给你一个完全满意的答案,但也许这会帮助你找到更通用的解决方案。 在表单上尝试以下OnShortCut事件处理程序: procedure TMyForm.FormShortCut(var Msg: TWMKey; var H ...
  • 您可以在SO上关注这些问题 在iPhone上将文件上传到FTP服务器 和这段代码。 http://code.google.com/p/s7ftprequest/ You can follow these question on SO Upload File to FTP Server on iPhone and this code. http://code.google.com/p/s7ftprequest/
  • 有时我们需要下载,从FTP服务器上传文件。 以下是FTP操作的一些示例。 为此,我们需要包含一个名称空间,它就是。 使用System.Net public void DownloadFile(string HostURL, string UserName, string Password, string SourceDirectory, string FileName, string LocalDirectory) { if (!File.Exists(LocalDi ...
  • 我从扩展的ftp-simple文档中看到有一个选项: confirm - 布尔 - (选项)只保存选项。 保存文件时,询问是否要覆盖该文件,如果该文件已存在。默认值:true 所以 "confirm" : false, 应该消除你所看到的警告/验证。 I see from the extension's ftp-simple documentation there is an option : confirm - boolean - (option) Only save option. When you ...
  • 您需要使方法async ,然后使用await进行任何异步操作。 您似乎只有其中一个,因此以下应该有效: public static async Task SelectRectangle(Point SourcePoint, Point DestinationPoint, Rectangle SelectionRectangle, string FilePath) { using (Bitmap bitmap = new Bitmap(SelectionRectangle.Width, Selecti ...
  • 这就是问题: StreamReader strRead = new StreamReader(file_store); byte[] fileContents = Encoding.UTF8.GetBytes(strRead.ReadToEnd()); 您正在读取文件,就好像它是UTF-8编码的文本一样。 它不是 - 它是一个图像。 任意二进制数据。 使用: byte[] fileContents = File.ReadAllBytes(file_store); 一切都应该没问题。 其余的代码仍然可以使 ...
  • 我们只需要将.lnk扩展名放到文件中,如下所示。 File file = new File("C://app.lnk"); //add .lnk (window shortcut extension) file.delete(); //now can delete shortcut We just have to put .lnk extension to the file as below. File file = new File("C://app.lnk"); //add .lnk (window ...
  • 使用SendInput() 。 我没有测试这个,但它应该工作: INPUT ctrlV [4]; ZeroMemory(ctrlv, sizeof ctrlV); ctrlV [0].type = INPUT_KEYBOARD; ctrlV [0].ki.wVk = VK_LCONTROL; ctrlV [1].type = INPUT_KEYBOARD; ctrlV [1].ki.wVk = 'V'; //assuming ASCII ctrlV [2].type = INPUT_KEYBOARD; ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)