<style>*{font-size: 30px;}</style>
//传地址 &
<?php
function sum($a,&$b){
$c=$a+$b;
$b++;
return $c;
}
$m=3;
echo sum(1,$m)+6; //10
echo "<br />".$m; //4
?>
// initial value of the error wording, but the system is not being given
? <PHP
function SUM (A = $ 10, $ B) {// an error writing
$ $ C = A + B $;
$ B ++;
return $ C;
}
echo sum(12,3)+6;
?>
// global variables Global
? <PHP
$ A = 10;
$ B = 0;
function SUM () {
Global $ A; // declare a global variable
$ a = 5; // exchange position and view the results on a
$ b = $ +. 3 A;
return $ B;
}
echo SUM ();
echo $ A;
echo $ B;
// constant variable address
<PHP?
Function SUM () {
static $ A = 0; // static variable
return $ A ++;
}
echo sum();//1
echo sum();//2
echo sum();//3
echo sum();//4
echo sum();//5
// variable function as variable variables (the function name put into a variable)
<? PHP
function sum(){
static $a=0;
return ++$a;
}
A = $ "SUM";
echo $ A (); // a variable function
echo $ A ();
echo $ A ();
// recursion (a brother company for an interview but I want to test)
<? PHP
// monkeys eat fruit half +1 10 days -> 1
$ = the n-10;
function EAT (the n-$) {
IF (the n-$ == 1) return 1; // terminate the last statement.
else return (eat ($ n- 1) +1) * 2; // next asked his answer
}
echo EAT ($ n-);
echo "<HR />";
// $sum=0;
// for($i=1;$i<=100;$i++){
// $sum+=$i;
// }
// echo $sum;
function sum100($a){
if($a==1) return 1;
else return sum100($a-1)+$a;
}
echo sum100(100);
// Tower of Hanoi (monkey IQ test used)
// omitted here a million words
//include+(_once) require +(_once)
// is simply added to the master view
<?php
include_once("top.php");
include_once("top.php");
//require("abc.php");
// echo "hello";
// echo("hello");
// print("hello");
// print "hello";
echo "hello","world";
// print "hello","world"; //错误
echo print("hello");
@print($x);
include("footer.php");