<tfoot id='6GrqG'></tfoot>
    <legend id='6GrqG'><style id='6GrqG'><dir id='6GrqG'><q id='6GrqG'></q></dir></style></legend>

    <small id='6GrqG'></small><noframes id='6GrqG'>

      <bdo id='6GrqG'></bdo><ul id='6GrqG'></ul>

      1. <i id='6GrqG'><tr id='6GrqG'><dt id='6GrqG'><q id='6GrqG'><span id='6GrqG'><b id='6GrqG'><form id='6GrqG'><ins id='6GrqG'></ins><ul id='6GrqG'></ul><sub id='6GrqG'></sub></form><legend id='6GrqG'></legend><bdo id='6GrqG'><pre id='6GrqG'><center id='6GrqG'></center></pre></bdo></b><th id='6GrqG'></th></span></q></dt></tr></i><div id='6GrqG'><tfoot id='6GrqG'></tfoot><dl id='6GrqG'><fieldset id='6GrqG'></fieldset></dl></div>

        类型转换与函数在 PHP 中转换变量类型

        Typecasting vs function to convert variable type in PHP(类型转换与函数在 PHP 中转换变量类型)
            <tbody id='VIEZF'></tbody>
          <i id='VIEZF'><tr id='VIEZF'><dt id='VIEZF'><q id='VIEZF'><span id='VIEZF'><b id='VIEZF'><form id='VIEZF'><ins id='VIEZF'></ins><ul id='VIEZF'></ul><sub id='VIEZF'></sub></form><legend id='VIEZF'></legend><bdo id='VIEZF'><pre id='VIEZF'><center id='VIEZF'></center></pre></bdo></b><th id='VIEZF'></th></span></q></dt></tr></i><div id='VIEZF'><tfoot id='VIEZF'></tfoot><dl id='VIEZF'><fieldset id='VIEZF'></fieldset></dl></div>

                <bdo id='VIEZF'></bdo><ul id='VIEZF'></ul>
              • <small id='VIEZF'></small><noframes id='VIEZF'>

                  <tfoot id='VIEZF'></tfoot>

                  <legend id='VIEZF'><style id='VIEZF'><dir id='VIEZF'><q id='VIEZF'></q></dir></style></legend>

                  本文介绍了类型转换与函数在 PHP 中转换变量类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  类型转换和使用函数将变量转换为某种类型有什么区别吗?

                  Is there any difference between typecasting and using a function to convert a variable to some type?

                  (float)$var VS.floatval($var)

                  如果有,什么时候应该使用其中一个而不是另一个?

                  If there are, when one of those should be used instead of the other?

                  推荐答案

                  结果值没有区别,只是:

                  There's no difference in the resulting value, just:

                  • (float) 是一种语言特性,速度非常快
                  • floatval() 导致函数调用的开销(最小,但仍然......)
                  • floatval() 作为函数可以以 (float) 不能的方式使用,例如array_map('floatval', $foo)
                  • (float) is a language feature and very quick
                  • floatval() incurs the overhead of a function call (minimal, but nonetheless...)
                  • floatval() as a function can be used in ways that (float) cannot, e.g. array_map('floatval', $foo)

                  最后一点,我认为是 floatval 存在的主要原因:所以每个转换操作都有一个等价的函数,这在某些情况下很有用.

                  The last point is, I believe, the main reason for floatval's existence: so each casting operation has a function equivalent, which can be useful in some circumstances.

                  这篇关于类型转换与函数在 PHP 中转换变量类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                      <bdo id='hRMXX'></bdo><ul id='hRMXX'></ul>

                      <legend id='hRMXX'><style id='hRMXX'><dir id='hRMXX'><q id='hRMXX'></q></dir></style></legend>
                      <i id='hRMXX'><tr id='hRMXX'><dt id='hRMXX'><q id='hRMXX'><span id='hRMXX'><b id='hRMXX'><form id='hRMXX'><ins id='hRMXX'></ins><ul id='hRMXX'></ul><sub id='hRMXX'></sub></form><legend id='hRMXX'></legend><bdo id='hRMXX'><pre id='hRMXX'><center id='hRMXX'></center></pre></bdo></b><th id='hRMXX'></th></span></q></dt></tr></i><div id='hRMXX'><tfoot id='hRMXX'></tfoot><dl id='hRMXX'><fieldset id='hRMXX'></fieldset></dl></div>
                    • <small id='hRMXX'></small><noframes id='hRMXX'>

                      <tfoot id='hRMXX'></tfoot>
                        <tbody id='hRMXX'></tbody>