function test($name, $command_output, $good_output) { global $testfail; if ($command_output == $good_output) { $test_passfail = '<font color="green">PASS</font>'; } else { $test_passfail = '<font color="red">FAIL</font>'; $testfail = true; } test_add($name . ': <font color="blue">' . $command_output . '</font>. Should be: ' . $good_output . '. → ' . $test_passfail . '<br>'); }
<?php echo 'hello<br/>'; $res = test_add(1, 2); echo '结果是' . $res; $res = test_deL(5, 1); echo '<br/>' . $res; function test_del($num1, $num2) { return $num1 - $num2; } ?> <?php echo '<br/>world'; ?> <?php function test_add($num1, $num2) { return $num1 + $num2; }