Home > Web Front-end > JS Tutorial > body text

A brief analysis of the differences between js functions and php functions

PHPz
Release: 2018-09-29 17:33:03
forward
1963 people have browsed it

This article mainly introduces the difference between js functions and php functions. It briefly analyzes the differences in syntax and application between js functions and php functions in the form of examples. It has certain reference value. Friends who need it can refer to it.

This article analyzes the difference between js functions and php functions with examples. Share it with everyone for your reference. The specific analysis is as follows:

In PHP syntax, a function is a grammatical structure, not a variable and cannot be assigned a value;

In JS, a function is also a type of variable, and the variable name is function name.

<html>
<head>
</head>
<body>
<script type="text/javascript">
function t(){
 return 5;
}
var m = t;//函数名即是变量名。注意,不能写成t(),加括号是表示调用这个函数。
alert(m());
</script>
</body>
</html>
Copy after login

So, the function can also be declared like this:

t = function(参数){
 函数体;
}
Copy after login
Related labels:
source:jb51.net
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!