<?php
$ly = 233;
echo "ly's value:{$ly}<br> ".$ly;
echo "<br>is {$ly} a number?:".is_numeric($ly);
echo "<br>当前文件路径:".__FILE__;
echo "<br>PHP运行的操作系统:".PHP_OS;
echo "<br>当前PHP的版本号:".PHP_VERSION;
echo "<br>";
$a = "1114";
$b = "22322";
if($a=="1514")goto END;
var_dump($a);
echo "<br>";
var_dump($b);
echo "<br>";
$c = $a.$b;
var_dump($c);
echo "<br>";
$d = $a+$b;
var_dump($d);
echo "\n";
END:
if($a>$b)echo "大于";
elseif($a==$b)echo "等于";
else echo "小于<br>";
function out(){
echo "233";
}
out();
function swap(&$x,&$y){
$tmp = $x;
$x = $y;
$y = $tmp;
}
swap($a,$b);
echo "{$a} , {$b}<br>";
$ulganoy = 'swap';
$ulganoy($a,$b);
echo "{$a} , {$b}<br>";
function add($a,$b){
echo "{$a} + {$b} = ".($a+$b).'<br>';
}
function sub($a,$b){
echo "{$a} - {$b} = ".($a-$b).'<br>';
}
function mul($a,$b){
echo "{$a} * {$b} = ".($a*$b).'<br>';
}
function div($a,$b){
echo "{$a} / {$b} = ".($a/$b).'<br>';
}
function cal($a,$b,$op){
if(!is_callable($op)){
echo "please check again!";
return false;
}
$op($a,$b);
}
cal($a,$b,'mul');
call_user_func_array('div',array($a,$b));
?>
相应结果