我是靠谱客的博主 凶狠黄豆,这篇文章主要介绍PHP:表达式,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>表达式</title> </head> <body> <?php date_default_timezone_set("Asia/Shanghai"); #表达式 /** * 执行运算符反引号``,运行DOS或linux命令 */ function demo() { $output = ` dir `; echo "<pre> $output </pre>" ; // $output_linux = `ls -al`; // echo "<pre> $output_linux </pre>" ; } // demo(); /** * 错误控制运算符'@', 用于隐藏错误信息,但set_error_handler设置的自定义错误处理函数仍然会被调用 */ function demo2() { $my_file = @ file ( 'non_existent_file' ) or die ( "Failed opening file: error was ' $php_errormsg '" ); $value = @ $cache [ $key ]; } // demo2(); /** * 数组运算符 */ function demo3() { $a = array( 'a' => 'A' ); $b = array( 'a' => 'AA', 'b' => 'B' ); var_dump($a + $b); echo '<br>'; var_dump($b + $a); } // demo3(); /** * 类型运算符 * instanceof * tips: 也可用于继承的子类或继承接口的子类判断 */ function demo4() { class MyClass {} class NotMyClass {} $a = new MyClass(); var_dump($a instanceof MyClass); echo '<br>'; var_dump($a instanceof NotMyClass); } demo4(); ?> </body> </html>

最后

以上就是凶狠黄豆最近收集整理的关于PHP:表达式的全部内容,更多相关PHP内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(66)

评论列表共有 0 条评论

立即
投稿
返回
顶部