PHP and JavaScript are also dynamic languages, but there are many differences between them. Compare here.
JavaScript PHP
| variable names can start with a $ or letter |
variable names must begin with $ |
The
| variable definition is typically used with the var keyword |
variable definition without var |
The
| string is the same as the single quotation mark and the double quote effect |
strings are not escaped with single quotes, and are escaped with double quotes |
| logical operators only && and | | This form |
logical operators have && and | | And and and or two forms, and the two form priorities are different |
A semicolon at the end of the
| statement can omit the semicolon at the end of the |
statement, not omit the |
The
| string supports Unicode |
strings that do not support Unicode |
The
| connection string is used with the + sign |
connection string. # |
| You can use global variables directly inside a function |
to use global variables inside a function must first be declared with the Global keyword |
| Gets the nth character of a string with Str.charat (n) |
to get the nth character of a string with Str[i] |
| ordered index with array, unordered index with object |
ordered index and unordered index can be used array |
| concatenate all elements of an array use the Join function |
to concatenate all elements of an array with the Implode function |
Resources:
[1] ECMAScript Standard
[2] PHP official manual