PHP_零基础学php_3PHP函数、传参函数、默认参数、函数返回值

<?php 

function say_hello() //无参数

{

    $name="tang";

    echo "hello,".$name;

    echo "<br />";

    echo "<hr />";

}

say_hello();//函数调用



function say_helloS($some_name)//有参数

{

    echo "hello,".$some_name;

    echo "<br/>";

    echo "<hr />";

}

say_helloS("tang");

say_helloS("xue");

say_helloS("long");



function say_helloT($some_name="tangwei")//带有默认参数的函数

{

    echo $some_name." is god girl!";

}

say_helloT();

?>

 

你可能感兴趣的:(PHP)