Home > Backend Development > PHP Tutorial > photoshop learning website php learning notes function declaration two

photoshop learning website php learning notes function declaration two

WBOY
Release: 2016-07-29 08:45:27
Original
927 people have browsed it

Copy the code The code is as follows:


/*
* 1. Internal function: PHP can declare the function
* inside the function for the purpose of calling
* inside the function to help external functions Complete some sub-functions
*
* 2. Recursive function: call your own function name internally
*
* 3. Reuse functions
*
* require: for static inclusion
* include: for dynamic inclusion
* require_once : used for static inclusion, only included once
* include_once: used for dynamic inclusion, only included once
*
* 4. Use of some system functions
* resource = opendir ("directory name")
* readdir (resource)
*
*
*/
//Internal function
function score($php,$java,$dotnet)
{
function php($php)
{
if($php>60)
return "pass";
else
return "failed";
}
function java($java)
{
if($java>60)
return "passed";
else
return "failed";
}
function dotnet($dotnet )
{
if($dotnet>60)
return "pass";
else
return "fail";
}
$total=$php+$java+$dotnet;
$agv=$total/3;
echo "Your php score is {$php} points,".php($php)."
";
echo "Your java score is {$java} points,".java($java)."
";
echo "Your dotnet score is {$dotnet} points,".dotnet($dotnet)."
";
echo "Your total score is: {$total}< br>";
echo "Your average score is: {$agv}
";
}
score(50,90,70);
//Recursive function
function demo($num)
{
echo $num."
";
if($num>0)
demo($num-1);
else
echo "----------------- ---------------
";
echo $num."
";
}
demo(10);
function total($dirname,&$ dirnum,&$filename)
{
$dir=opendir($dirname);
readdir($dir)."
";
readdir($dir)."
";
while($ filename=readdir($dir))
{
$newfile=$dirname."/".$filename;
echo $filename."
";
if(is_dir($filename
}
}
$dirnum =0;
$filenum=0;
total("c:/windows",$dirnum,$filenum);
echo "Total number of directories: ".$dirnum."
";
echo "Total number of files: ".$filenum."
";
?>

The above introduces the function statement two of the photoshop learning website PHP learning notes, including the content of the photoshop learning website. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template