Home > Backend Development > PHP Tutorial > if内如果是函数,函数就自个儿执行了

if内如果是函数,函数就自个儿执行了

WBOY
Release: 2016-06-13 12:04:33
Original
1061 people have browsed it

if内如果是函数,函数就自己执行了?
require_once("include/conn.php");
//***********************删除一条记录************************************
if(isset($_GET["id"]))
{
$id=intval($_GET["id"]);
$sql="delete from {$db_prefix}class_news where id=$id";
if(mysql_query($sql))
{
$message=urlencode("删除成功!");
$url="class_news_manage.php";
echo "<script>location.href='success.php?message=$message&url=$url'</script>";
exit();
}else
{
$message=urlencode("删除失败!");
echo "<script>location.href='error.php?message=$message'</script>";
exit();
}
}
?>

前面并没有写执行函数的代码,只是if里面判断了函数的执行返回结果。请问if里面的内容是一个函数,那么函数是自己执行吗?
------解决方案--------------------
會執行的,然後根據函數返回的結果判斷true,false。
------解决方案--------------------
您不是 只是if里面判断了函数的执行返回结果 吗?
不执行哪来的结果
------解决方案--------------------
if里面如果是个函数或者表达式,会先执行完之后才判断
你可以写个函数来试一下

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template