$con"; } $str="Simple function test!"; echo "Normal text: $str
"; echo "Bold text:".fontBold($ str).""; /* * with"/>
$con"; } $str="Simple function test!"; echo "Normal text: $str
"; echo "Bold text:".fontBold($ str).""; /* * with">
Home > Article > Backend Development > photoshop cs2 v9.0 green Chinese version PHP entry learning knowledge point seven basic application of PHP functions
Copy the code The code is as follows:
/*
* Simple function
*/
function fontBold($con){
return "$con" ;
}
$str="Simple function test!";
echo "Normal text: $str
";
echo "Bold text:".fontBold($str)."";
/*
* Function with optional parameters
*/
function fontColor($con,$color="bule"){
return "$con";
}
$str="Color test";
echo $str;
echo fontColor($str."This is without color parameters (default is blue)!");
echo fontColor($str,"red"." This is with a color parameter (red by default!)");
/*
* Recursive function
*/
function chckint($Num){
if($Num>1){
return chckint($Num-1 );
}else if($Num<0){
return chckint(($Num*-1)-1);
}else{
if($Num>0 && $Num<1){
return false;
}else if($Num){
return true;
}
}
}
$Num=3;
if(chckint($Num)){
echo $Num."It’s an integer!";
}else{
echo $Num."Not an integer";
}
/*
*Dynamic call function
*/
function write($con){
echo "$con";
}
function writeBold($con){
echo "$con";
}
$myFupnction="write";
$myFupnction("This is an example of dynamically calling a function without bolding it!");
$myFupnction="writeBold";
$myFupnction("This is an example of dynamically calling bold!")
?>
The above introduces the basic application of photoshop cs2 v9.0 green Chinese version PHP introductory learning knowledge point seven, including the content of photoshop cs2 v9.0 green Chinese version. I hope it will be helpful to friends who are interested in PHP tutorials.