PHP function Declaration (c)

Source: Internet
Author: User

1. Intrinsic function: PHP can declare the function inside the function, (the purpose is to call inside the function)

Function score ($php, $java, $dotnet) {
function php ($php) {
if ($php >60)
return "Pass";
Else
Return "Not polar";
}

function Java ($java) {
if ($java >60)
return "Pass";
Else
Return "Failed";
}

function dotnet ($dotnet) {
if ($dotnet > 60)
return "Pass";
Else
Return "Failed";
}

$total = $php + $java + $dotnet;

$AGV = $total/3;

echo "Your PHP score is {$php} points,". PHP ($php). " <br> ";
echo "Your Java score is {$java} points,". Java ($java). " <br> ";
echo "Your dotnet score is {$dotnet},". dotnet ($dotnet). " <br> ";

echo "Your total score is: {$total} <br>";
echo "Your average score is: {$AGV} <br>";
}


Score (50, 90, 70);

2. Recursive function: It is to call their own internal function name

3. Reusing functions:

PHP function Declaration (c)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.