如何创建特定的PHP函数 [英] How can I make a specific PHP function
问题描述
大家好,我是PHP的新手。我有一个问题,我想制作一个PHP函数,如果它小于75,将检查数字。我做了一个PHP函数,但我不知道这是否正确。这是我的旧代码,我想简化它。
if($ _ POST [grade]< 75)
{
echo'成绩无效';
}
elseif($ _ POST ['grade2']< 75)
{
echo'invalid grade';
}
这是我目前的php函数代码:
函数numeric($ string)
{
返回.......我不知道下一个
}
先谢谢你们
Hello guys, I am newbie in PHP. I have a problem I want to make a php function that will check the number if it is less than 75. I made a PHP function but I am not sure if this is correct. This is my old code an I want to simplify it.
if($_POST[grade] < 75)
{
echo 'Invalid grade';
}
elseif($_POST['grade2'] < 75)
{
echo'invalid grade';
}
Here is my current php function code:
function numeric($string)
{
return ....... i dont know the next
}
thanks in advance guys
推荐答案
_POST [等级]< 75)
{
echo'无效成绩';
}
elseif(
_POST[grade] < 75)
{
echo 'Invalid grade';
}
elseif(
_POST ['grade2']< 75)
{
echo'invalid grade';
}
这是我目前的php函数代码:
函数numeric(
_POST['grade2'] < 75)
{
echo'invalid grade';
}
Here is my current php function code:
function numeric(
string)
{
返回.......我不知道下一个
}
先谢谢你们
string)
{
return ....... i dont know the next
}
thanks in advance guys
这篇关于如何创建特定的PHP函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!