Home >Backend Development >PHP Tutorial >Self-study demonstration for getting started with PHP, self-study demonstration for getting started with PHP_PHP tutorial
//Function definition
function name(){
echo "This is a parameterless function";
}
name();//no parameter function call
function name($age,$height){
print "This is a parameterized function
";
echo "Height".$height.",Age:".$age."CM";
}
name(20,170);
/*
The following are some knowledge points recorded by newcomers’ self-study. If the masters don’t like it, please don’t comment.
There are two main types of output statements in PHP;
1: print, output a single variable or string;
2: echo, outputs multiple variables or strings, and the execution efficiency is much faster than print.
3: PHP is a weakly typed language;
4: Loops, judgments, and branch selection statements in php are similar to statements in C# and js;
5: The array naming method is a bit unique:
$arr=array(key=>value,key=>value,...);
Example: $man=array("age"=>20,"height"=>172,"weight"=>60);
The index does not necessarily start from [0], but the "age", "height" and "weight" we define ourselves;
If you want to get the elements in the array, you can only use $man["age"], $man["height"], $man["height"];
*/
?>