Home  >  Q&A  >  body text

Can anyone give me some instructions on this assignment?

http://www.php.cn/code/1084.html

Can anyone give me some instructions on this assignment? It cannot be completed

【H】™☆Ley【H】™☆Ley2719 days ago1970

reply all(6)I'll reply

  • 卖女孩的小火柴哟

    卖女孩的小火柴哟2018-03-05 18:18:35

    <?php
        function renderTable($c0,$c1='red') {
            $table = '<table border="1">';
            for($i=1;$i<10;$i++) {
                // if ($i%2==0) {
                //     $table .= "<tr bgcolor={$c0}>";
                // } else {
                //     $table .= "<tr bgcolor={$c1}>";
                // }
                $table .= "<tr bgcolor='#$i(16-$i)$i'>";
                for($j=1;$j<10;$j++) {
                    $table .= '<td>'.$i.'x'.$j.'='.$i*$j.'</td>';
                }
                $table .= '</tr>';
            }
            $table .= '</table>';
            return $table;
        }
        echo renderTable('blue');
    ?>

    That’s it

    reply
    0
  • 不是铭跃

    不是铭跃2017-06-06 15:27:50

    <?php

    echo '<table>';

    function demo($color1,$color="pink",$cor=10,$row=10){

        for($x=0;$x<$row;$x++){

            if($x%2==0){

                echo "<tr bgcolor='$color'>";

            }else{

               echo"<tr bgcolor='$color1'>";

            }

            for($y=0;$y<$cor;$y++){

                echo "<td>".($x.$y)."</td>";

            }

        echo "<tr>" ;   

        }


        return "<table>";


    }


    $demo=demo('red');

    echo $demo;



    ?>


    reply
    3
  • 益伦

    return "<table>"; Why is this paragraph written like this? ? It's not echo "</table>"; I don't understand what it means? What role does it play?

    益伦 · 2017-10-16 15:25:58
  • 【H】™☆Ley

    【H】™☆Ley2017-06-02 14:54:52

    QQ截图20170602145454.jpg

    Can you complete this homework?

    Thank you

    reply
    0
  • 清晨的那一抹阳光照耀在我的脸上

    I suggest you figure it out on your own. This is the simplest code logic in PHP, and if you can do it when you first learn it, it will be of great help and encouragement to you.

    清晨的那一抹阳光照耀在我的脸上 · 2017-06-02 16:12:11
  • 清晨的那一抹阳光照耀在我的脸上

    清晨的那一抹阳光照耀在我的脸上2017-06-02 14:21:17

    This course is not difficult. PHP functions have this fixed grammatical structure, just remember it

    reply
    0
  • 【H】™☆Ley

    【H】™☆Ley2017-06-02 12:43:16

    Just help me complete the required homework at the bottom

    I don’t know how to do it

    I am a newbie

    Thank you! ! !

    reply
    0
  • PHPz

    PHPz2017-06-02 11:12:55

    Please be specific with your question, otherwise I won’t be able to help you!

    reply
    0
  • Cancelreply