1. Basic types
php的基本类型分别:
1.基本数据类型:整型、小数(float/double)、字符串、布尔类型
2.复合类型:数组、对象
3.特殊类型:Null,资源类型
JavaScript的基本类型:Undefined,Null,Boolean,Number 和 String。
区别:php 有资源类型,小数分单双精度,而Js的数的类型只是Number,且有Undefined类型。
2. String concatenation
php 的字符串连接符是 : " . "
Js 的字符串连接符是 : " + "
3. Array addition
php 数组相加用: " + ",可以直接相加
Js 用函数拼接: concat
4. Case sensitivity
php : 只有变量名区分大小写
Js : 全部区分大小写
5. Declare variables
php : 变量声明用 : " $变量名 "
Js : 变量声明 : " var 变量名 "
6. Characters String function
php 求字符串长度等函数用单独的: strlen()
Js : 是面向对象的语言,String对象内置了函数,字符串.length,直接求。
7. Function parameter problem
php : 参数多传了可以,但不可以少传
Js : 传几个都可以,有 arguments 对象接收参数
Copyright statement: This article is an original article by the blogger and may not be reproduced without the permission of the blogger.
The above introduces the grammatical differences between 1 JavaScript and PHP, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.