1 syntax differences between JavaScript and PHP

Source: Internet
Author: User
1. Basic types

php的基本类型分别:1.基本数据类型:整型、小数(float/double)、字符串、布尔类型2.复合类型:数组、对象3.特殊类型:Null,资源类型JavaScript的基本类型:Undefined,Null,Boolean,NumberString。区别:php 有资源类型,小数分单双精度,而Js的数的类型只是Number,且有Undefined类型。

2. String connector

 php 的字符串连接符是 :   "  .  ""  +  "

3. Adding arrays

php 数组相加用:  " + "concat

4. Case sensitivity

php : 只有变量名区分大小写Js : 全部区分大小写

5. Declaring variables

php : 变量声明用 :  " $变量名 "" var 变量名 "

6. String functions

php 求字符串长度等函数用单独的: strlen()Js : 是面向对象的语言,String对象内置了函数,字符串.length,直接求。

7. Function parameter Problems

arguments 对象接收参数

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the 1 JavaScript and PHP syntax differences, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.