Example code _ php Tutorial

Source: Internet
Author: User
Php specifies the sample code for the default function parameter value. Example 1 copy the code as follows: the htmlheadtitlephp function specifies the default value-www. jbxue. comtitleheadbody? PhpfunctionprintMe ($ paramNULL) {print $ param;} printMe (Thisistest Example 1

The code is as follows:




Php function specifies the default value -www.jbxue.com


Function printMe ($ param = NULL)
{
Print $ param;
}
PrintMe ("This is test ");
PrintMe ();
?>



Output result:
This is test

Example 2 use the default values of php function parameters. set and use the default values in php function parameters.

The code is as follows:




Default value of php function parameters-www.jbxue.com


Function textonweb ($ content, $ fontsize = 3 ){
Echo "$ content ";
}
Textonweb ("
", 7 );
Textonweb ("AA.
");
Textonweb ("AAA.
");
Textonweb ("AAAA!
");
?>


The authorization code is as follows: the html head titlephp function specifies the default value -www.jbxue.com/title/head body? Php function printMe ($ param = NULL) {print $ param;} printMe ("This is test "...

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.