phpsin
Ⅰ php函数设定参数类型
php 函数的参数类型可以指定为类名或数组类型array,比如
这样是对的public function Right( My_Class $a, array $b )
这样是错的public function Wrong( string $a, boolean $b )
如果需要其他类型,需要在函数内部进行类型检查
参考
http://www.php.net/manual/zh/functions.arguments.php
这一段
public function Right( My_Class $a, array $b )
tells first argument have to by object of My_Class, second an array. My_Class means that you can pass also object of class that either extends My_Class or implements (if My_Class is abstract class) My_Class. If you need exactly My_Class you need to either make it final, or add some code to check what $a really.
Also note, that (unfortunately) "array" is the only built-in type you can use in signature. Any other types i.e.:
public function Wrong( string $a, boolean $b )
will cause an error, because PHP will complain that $a is not an *object* of class string (and $b is not an object of class boolean).
So if you need to know if $a is a string or $b bool, you need to write some code in your function body and i.e. throw exception if you detect type mismatch (or you can try to cast if it's doable).
Ⅱ PHP程序算出NAN
你的电脑现在的配置算不出更多次幂了,所以返回错误
Ⅲ PHP如何进行三表查询
你说的意思是 用php查询mysql 3个表里的语句 然后查询 输出 出来吧。
语句我给你写下来 你只需要填表的名字就可以了。
<?php
$sin=mysql_connect('localhost','root','');
mysql_select_db('abc',$sin)
$ain=mysql_query( "select * from 你要查询表的名字 "')
echo “$ain”;
?>
没看懂 追 希望能帮助您解决问题。
Ⅳ php算三角函数
cos — 余弦
cosh — 双曲余弦
sin — 正弦
sinh — 双曲正弦
tan — 正切
tanh — 双曲正切
acos — 反余弦
acosh — 反双曲余弦
asin — 反正弦
asinh — 反双曲正弦
atan2 — 两个参数的反正切
atan — 反正切
atanh — 反双曲正切
Ⅳ php 求角度函数
abs --- 取绝对值
acos --- 取反余弦值
asin --- 取反正弦值
atan --- 取反正切值
atan2 --- 取二个变量的反正切值
base_convert --- 转换数值的进位方式
bindec --- 二进制转十进制
ceil --- 取得大于指定数的最小整数值
cos --- 取余弦值
decbin --- 十进制转二进制
dechex --- 十进制转十六进制
decoct --- 十进制转八进制
deg2rad --- 将数值从度数转成径度
exp --- 取得自然对数的次方值
floor --- 取得小于指定数的最大整数值
getrandmax --- 取得最大乱数值
hexdec --- 十六进制转十进制
log --- 自然对数
log10 --- 底为10的对数
max --- 传回参数中最大值
min --- 传回参数中最小值
mt_rand --- 取得乱数值
mt_srand --- 设定乱数种子
mt_getrandmax --- 取得乱数最大值
number_format --- 将数字字符串格式化
octdec --- 八进制转十进制
pi --- 取得圆周率pi的值
pow --- 传回次方项的值
rad2deg --- 转换径度值为度数
rand --- 产生乱数值
round --- 取四拾五入
sin --- 取正弦值
sqrt --- 取平方根值
srand --- 设定乱数种子
tan --- 取正切值
Ⅵ 关于用php制作统计
帮你改好了 可以直接运行 至于问题 你自己慢慢发现吧 如果有不懂的 再来问我
<html>
<HEAD>
<TITLE>particular</TITLE>
</HEAD>
<BODY>
<form name="particular" method="post" enctype="multipart/form-data" action="particular.php">
<table>
姓名:<input name="player" size="16" type="text" /><br>
学院:<input name="school" size="30" type="text" /><br>
项目:<input name="game" size="30" type="text" /><br>
团体:
破记录<input name="teamb" type="checkbox" />
金<input name="teamj" type="checkbox" />
银<input name="teamy" type="checkbox" />
铜<input name="teamt" type="checkbox" />
<br>
个人:
破记录<input name="sinb" type="checkbox" />
金<input name="sinj" type="checkbox" />
银<input name="siny" type="checkbox" />
铜<input name="sint" type="checkbox" />
<br>
<input name="submit" type="submit" />
<input name="reset" type="reset" />
</table>
</form>
</BODY>
</HTML>
PHP文件
<html>
<head>
<title>particular.php</title>
</head>
<body>
<?php
//$arr=array
// ( teamb => 12,
// teamb => 6,
// teamb => 4,
// teamb => 2,
// teamb => 6,
// teamb => 3,
// teamb => 2,
// teamb => 1,
// );
$player=$_POST["player"]; #接收数据
$school=$_POST["school"];
$game=$_POST["game"];
$teamb=(!empty($_POST["teamb"]))?'12':'0';
$teamj=(!empty($_POST["teamj"]))?'6':'0';
$teamy=(!empty($_POST["teamy"]))?'4':'0';
$teamt=(!empty($_POST["teamt"]))?'2':'0';
$sinb=(!empty($_POST["sinb"]))?'6':'0';
$sinj=(!empty($_POST["sinj"]))?'3':'0';
$siny=(!empty($_POST["siny"]))?'2':'0';
$sint=(!empty($_POST["sint"]))?'1':'0';
$counterFile = "counterfile.txt"; #定义txt记录文本
//function displayCounter($counterFile$teamb) {
$fp = fopen($counterFile,"rw");
$num = fgets($fp,5);
$num=$num+$teamb+$teamj+$teamy+$teamt+$sinb+$sinj+$siny+$sint; #加上得分
echo"".$school."最新更新<br>"; #显示详细更新情况
echo"姓名:".$player."<br>";
echo"项目".$game."<br>";
echo"成绩".$teamb,$teamj,$teamy,$teamt,$sinb,$sinj,$siny,$sint."<br>";
echo"学院总成绩".$num."分<br>";
exec( "rm -rf $counterFile");
exec( "echo $num > $counterFile");
//}
if (!file_exists($counterFile)) {
exec( "echo 0 > $counterFile"); #如果记数器文件不存在,新建它并设置内容为0
}
//displayCounter($counterFile);
?>
</body>
</html>