1. PHP uses dots to spell strings, and js uses ampersands.
2. The php file should be placed in the www in the wamp file.
3. The embedding methods of php and js are the same, but the embedded tags are different.
4. PHP output syntax uses echo. Multiple strings can be output. Special output method var_dump().
5. PHP uses $ to define variables.
6. PHP’s special definition method. You can write any string in
$变量=<<<A A;
. Please note that the following A must be written in the upper case.
7. PHP parses escaping. Double quotes are allowed, but single quotes are not.
echo “he”\llo”
8. PHP force conversion string.
$a=(string)$a; settype($a,"string");
9. Commonly used functions for PHP variables
unset($a); 删除变量 var_dump(isset($a)); 判断变量是否存在; var_dump(empty($a)); 判断是够为空,变量不存在,变量等于零,空的字符串 都为空
10. PHP variables take addresses & represent variables to take addresses
For example:
$a=10; $b=&$a; echo $b;
The output variable is 10
11. PHP variable variables.
#13. Ternary operator$a="hello"; $hello="张三"; echo $$a;
$a = 10; echo $a==10?"OK":"NO";
PHP video tutorial
The above is the detailed content of The difference between php and js. For more information, please follow other related articles on the PHP Chinese website!