复杂情况下的PHP Foreach [英] PHP Foreach in complex scenario

查看:83
本文介绍了复杂情况下的PHP Foreach的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在其中一个网站上的PHP中找到了一个代码段.我将其插入下面的

 <?php 

        $ num = array(3.1,3.5);
        foreach($ num  as  $ value)
        {
        printf(" ,$ value, round($ value),floor($ value),ceil($ value));
        }
    ?>  



我不知道以下代码部分的含义.

printf(%.1f%.2f%.2f%.2f \ n"

解决方案

num = array(3.1,3.5); foreach(


num as


value) { printf("

I found a code snippet in PHP at one of the web sites. I will insert it at the below

<?php

        $num=array(3.1, 3.5);
        foreach($num as $value)
        {
        printf("%.1f %.2f %.2f %.2f\n", $value, round($value), floor($value), ceil($value));
        }
    ?>



I don''t know what is the meaning of the following part of the code.

printf("%.1f %.2f %.2f %.2f\n"

If you guys have a time please solve my problem too!

解决方案

num=array(3.1, 3.5); foreach(


num as


value) { printf("%.1f %.2f %.2f %.2f\n",


这篇关于复杂情况下的PHP Foreach的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆